Skip to content

Commit c35ec35

Browse files
committed
edit info on avoiding docker hub rate limits
1 parent 0625eda commit c35ec35

File tree

3 files changed

+86
-13
lines changed

3 files changed

+86
-13
lines changed

docs/enterprise/image-registry-rate-limits.md

Lines changed: 81 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,94 @@ This topic describes how to avoid rate limiting for anonymous and free authentic
66

77
On November 20, 2020, rate limits for anonymous and free authenticated use of Docker Hub went into effect.
88
Anonymous and Free Docker Hub users are limited to 100 and 200 container image pull requests per six hours, respectively.
9-
Docker Pro and Docker Team accounts continue to have unlimited access to pull container images from Docker Hub.
9+
Docker Pro and Docker Team accounts continue to have unlimited access to pull container images from Docker Hub. For more information on rate limits, see [Understanding Docker Hub rate limiting](https://www.docker.com/increase-rate-limits) on the Docker website.
1010

11-
For more information on rate limits, see [Understanding Docker Hub rate limiting](https://www.docker.com/increase-rate-limits) on the Docker website.
11+
If your application has public Docker Hub images that are rate limited, then an error occurs when the rate limit is reached. To avoid these errors, your users can pass a Docker Hub username and password to the `kots docker ensure-secret` command. This creates an `<app-slug>-kotsadm-dockerhub` secret for pulling Docker Hub images and applies the secret to Kubernetes manifests that have images. For more information about this command, see [Avoiding Docker Hub Rate Limits](/enterprise/image-registry-rate-limits).
1212

13-
If the application that you are installing or upgrading has public Docker Hub images that are rate limited, then an error occurs when the rate limit is reached.
13+
If you are deploying a Helm chart with Docker Hub images that could be rate limited, any Pod definitions in your Helm chart templates that reference the rate-limited image must be updated to access the `<app-slug>-kotsadm-dockerhub` pull secret.
14+
15+
## Inject the Docker Hub Pull Secret
16+
17+
For installations with HelmChart v2, you need to configure the `values` key of the HelmChart v2 custom resource to ensure that the KOTS Docker Hub pull secret is added to any Pod definitions that reference rate-limited Docker Hub images. This allows your users to run the `kots docker ensure-secret` command.
18+
19+
To configure the HelmChart v2 custom resource:
20+
21+
1. For each HelmChart v2 resource in your release, configure the [`values`](/reference/custom-resource-helmchart-v2#values) key to add a new value with the KOTS `APP_SLUG-kotsadm-dockerhub` pull secret, where `APP_SLUG` is your unique application slug.
22+
23+
**Example:**
24+
25+
```yaml
26+
# kots.io/v1beta2 HelmChart custom resource
27+
apiVersion: kots.io/v1beta2
28+
kind: HelmChart
29+
metadata:
30+
name: samplechart
31+
spec:
32+
values:
33+
image:
34+
registry: docker.io
35+
repository: your-org/example-docker-hub-image
36+
# Add a new pullSecrets array with the <app-slug>-kotsadm-dockerhub pull secret
37+
pullSecrets:
38+
- name: your-app-slug-kotsadm-dockerhub
39+
```
40+
41+
1. Ensure that there is a matching value in each of the corresponding Helm chart `values.yaml` files.
42+
43+
**Example:**
44+
45+
```yaml
46+
# Helm chart values.yaml file
47+
image:
48+
registry: docker.io
49+
repository: your-org/your-docker-hub-image
50+
# include the new pullSecrets array
51+
pullSecrets: []
52+
```
53+
54+
1. In your Helm chart templates, update any Pod definitions that reference rate-limited Docker Hub images to include the pull secret.
55+
56+
**Example:**
57+
58+
```yaml
59+
apiVersion: v1
60+
kind: Pod
61+
metadata:
62+
name: example
63+
spec:
64+
containers:
65+
- name: example
66+
image: {{ .Values.image.registry }}/{{ .Values.image.repository }}
67+
# the kotsadm-dockerhub pull secret is accessed from
68+
# the Helm values and added to this array
69+
{{- with .Values.image.pullSecrets }}
70+
imagePullSecrets:
71+
{{- toYaml . | nindent 2 }}
72+
{{- end }}
73+
```
1474

1575
## Provide Docker Hub Credentials
1676

17-
To avoid errors caused by reaching the Docker Hub rate limit, a Docker Hub username and password can be passed to the `kots docker ensure-secret` command. The Docker Hub username and password are used only to increase rate limits and do not need access to any private repositories on Docker Hub.
77+
To create an image pull secret for pulling Docker Hub images and apply the secret to all
78+
79+
1. Run the following command to create an image pull secret that KOTS can use when pulling Docker Hub images:
1880

19-
Example:
81+
```bash
82+
kubectl kots docker ensure-secret --dockerhub-username USERNAME --dockerhub-password PASSWORD --namespace NAMESPACE
83+
```
2084

21-
```bash
22-
kubectl kots docker ensure-secret --dockerhub-username sentrypro --dockerhub-password password --namespace sentry-pro
23-
```
85+
Where:
86+
* `USERNAME` is the username for the Docker Pro or Docker Team account
87+
* `PASSWORD` is the password for the account
88+
:::note
89+
The Docker Hub username and password are used only to increase rate limits and do not need access to any private repositories on Docker Hub.
90+
:::
91+
* `NAMESPACE` is the namespace in the cluster where the application is installed. For Embedded Cluster installations, the application is installed in the `kotsadm` namespace by default.
2492

25-
The `kots docker ensure-secret` command creates an image pull secret that KOTS can use when pulling images.
93+
For more information, see [docker ensure-secret](/reference/kots-cli-docker-ensure-secret) in the KOTS CLI documentation.
2694

27-
KOTS then creates a new release sequence for the application to apply the image pull secret to all Kubernetes manifests that have images. After running the `kots docker ensure-secret` command, deploy this new release sequence either from the Admin Console or the KOTS CLI.
95+
After `kots docker ensure-secret` runs, KOTS automatically creates a new release sequence for the application.
2896

29-
For more information, see [docker ensure-secret](/reference/kots-cli-docker-ensure-secret) in the KOTS CLI documentation.
97+
1. Deploy the new release sequence either from the Admin Console or the KOTS CLI.
98+
99+
This ensures the image pull secret is applied to all Pod definitions that reference .

docs/reference/kots-cli-docker-ensure-secret.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# docker ensure-secret
22

3-
Creates an image pull secret for Docker Hub that the Admin Console can utilize to avoid [rate limiting](/enterprise/image-registry-rate-limits).
3+
Creates an image pull secret for Docker Hub that the Admin Console can utilize to avoid rate limiting.
4+
45
The credentials are validated before creating the image pull secret.
56
Running this command creates a new application version, based on the latest version, with the new image pull secret added to all Kubernetes manifests that have images.
67
In order for this secret to take effect to avoid rate limiting, the new version must be deployed.
78

9+
For more information, see [Avoid Docker Hub Rate Limits](/enterprise/image-registry-rate-limits).
10+
811
### Usage
912

1013
```bash

sidebars.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,9 @@ const sidebars = {
408408
label: 'Configure Local Image Registries',
409409
items: [
410410
'enterprise/image-registry-settings',
411-
'enterprise/image-registry-rate-limits',
412411
],
413412
},
413+
'enterprise/image-registry-rate-limits',
414414
'enterprise/updating-licenses',
415415
{
416416
type: 'category',

0 commit comments

Comments
 (0)