Skip to content

Commit ffcac06

Browse files
committed
Edit docs on using the proxy registry
1 parent cbb8e6c commit ffcac06

File tree

5 files changed

+185
-79
lines changed

5 files changed

+185
-79
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
If you are deploying Pods to namespaces other than the application namespace, add the namespace to the `additionalNamespaces` attribute of the KOTS Application custom resource. This ensures that KOTS can provision the `imagePullSecret` in the namespace to allow the Pod to pull the image. For instructions, see [Define Additional Namespaces](operator-defining-additional-namespaces).
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
In the HelmChart v2 custom resource, configure the `values` key to inject the Replicated image pull secret into your Helm values. This provides authentication for the proxy registry. Use the KOTS [ImagePullSecretName](/reference/template-functions-config-context#imagepullsecretname) template function to get the pull secret name.
2+
3+
<details>
4+
<summary>What is the Replicated image pull secret?</summary>
5+
<p>During application deployment, KOTS automatically creates an `imagePullSecret` with `type: kubernetes.io/dockerconfigjson` that is based on the customer license. This secret is used to authenticate with the proxy registry and grant proxy access to private images. For information about how Kubernetes uses the `kubernetes.io/dockerconfigjson` Secret type to authenticate to a private image registry, see [Pull an Image from a Private Registry](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) in the Kubernetes documentation.</p>
6+
</details>
7+
8+
**Example**:
9+
10+
```yaml
11+
# kots.io/v1beta2 HelmChart custom resource
12+
13+
apiVersion: kots.io/v1beta2
14+
kind: HelmChart
15+
metadata:
16+
name: samplechart
17+
spec:
18+
values:
19+
image:
20+
# Get the pull secret name with ImagePullSecretName
21+
pullSecrets:
22+
- name: '{{repl ImagePullSecretName }}'
23+
```
24+
Ensure that you provide this pull secret in any Pod definitions that reference images to be pulled through the proxy registry.
25+
**Example**:
26+
```yaml
27+
apiVersion: v1
28+
kind: Pod
29+
metadata:
30+
name: nginx
31+
spec:
32+
containers:
33+
- name: nginx
34+
image: {{ .Values.image.registry }}/{{ .Values.image.repository }}
35+
# Access the value to provide the KOTS pull secret
36+
{{- with .Values.image.pullSecrets }}
37+
imagePullSecrets:
38+
{{- toYaml . | nindent 2 }}
39+
{{- end }}
40+
```
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
For each image reference in your Helm chart values file, set the image repository URL to the location of the image on the proxy registry. This is either `proxy.replicated.com` or your custom domain.
2+
3+
The proxy registry URL has the following format: `DOMAIN/proxy/APP_SLUG/EXTERNAL_REGISTRY_IMAGE_URL`
4+
5+
Where:
6+
* `DOMAIN` is either `proxy.replicated.com` or your custom domain.
7+
* `APP_SLUG` is the unique slug of your application.
8+
* `EXTERNAL_REGISTRY_IMAGE_URL` is the path to the private image on your external registry.
9+
10+
**Example:**
11+
12+
```yaml
13+
# values.yaml
14+
api:
15+
image:
16+
# proxy.replicated.com or your custom domain
17+
registry: proxy.replicated.com
18+
repository: proxy/your-app/ghcr.io/cloudnative-pg/cloudnative-pg
19+
tag: catalog-1.24.0
20+
```
21+
Ensure that any references to the image in your Helm chart access the field from your values file.
22+
**Example**:
23+
```yaml
24+
apiVersion: v1
25+
kind: Pod
26+
spec:
27+
containers:
28+
- name: api
29+
# Access the registry, repository, and tag fields from the values file
30+
image: {{ .Values.image.api.registry }}/{{ .Values.image.api.repository }}:{{ .Values.image.api.tag }}

docs/vendor/helm-image-registry.mdx

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import StepCreds from "../partials/proxy-service/_step-creds.mdx"
22
import StepCustomDomain from "../partials/proxy-service/_step-custom-domain.mdx"
3+
import RewriteHelmValues from "../partials/proxy-service/_step-rewrite-helm-values.mdx"
34

45
# Use the Proxy Registry with Helm Installations
56

@@ -21,40 +22,7 @@ To use the Replicated proxy registry for applications installed with Helm:
2122

2223
1. <StepCustomDomain/>
2324

24-
1. In your Helm chart values file, set your image repository URL to the location of the image on the proxy registry. If you added a custom domain, use your custom domain. Otherwise, use `proxy.replicated.com`.
25-
26-
The proxy registry URL has the following format: `DOMAIN/proxy/APP_SLUG/EXTERNAL_REGISTRY_IMAGE_URL`
27-
28-
Where:
29-
* `DOMAIN` is either `proxy.replicated.com` or your custom domain.
30-
* `APP_SLUG` is the unique slug of your application.
31-
* `EXTERNAL_REGISTRY_IMAGE_URL` is the path to the private image on your external registry.
32-
33-
**Example:**
34-
35-
```yaml
36-
# values.yaml
37-
api:
38-
image:
39-
# proxy.replicated.com or your custom domain
40-
registry: proxy.replicated.com
41-
repository: proxy/your-app/ghcr.io/cloudnative-pg/cloudnative-pg
42-
tag: catalog-1.24.0
43-
```
44-
45-
1. Ensure that any references to the image in your Helm chart access the field from your values file.
46-
47-
**Example**:
48-
49-
```yaml
50-
apiVersion: v1
51-
kind: Pod
52-
spec:
53-
containers:
54-
- name: api
55-
# Access the registry, repository, and tag fields from the values file
56-
image: {{ .Values.images.api.registry }}/{{ .Values.images.api.repository }}:{{ .Values.images.api.tag }}
57-
```
25+
1. <RewriteHelmValues/>
5826

5927
1. In your Helm chart templates, create a Kubernetes Secret to evaluate if the `global.replicated.dockerconfigjson` value is set and then write the rendered value into a Secret on the cluster, as shown below.
6028

Lines changed: 112 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,142 @@
11
import Deprecated from "../partials/helm/_replicated-deprecated.mdx"
22
import StepCreds from "../partials/proxy-service/_step-creds.mdx"
33
import StepCustomDomain from "../partials/proxy-service/_step-custom-domain.mdx"
4+
import RewriteHelmValues from "../partials/proxy-service/_step-rewrite-helm-values.mdx"
5+
import AdditionalNs from "../partials/proxy-service/_step-additional-ns.mdx"
6+
import InjectPullSecret from "../partials/proxy-service/_step-inject-pull-secret.mdx"
47

5-
# Use the Proxy Registry with KOTS Installations
8+
# Use the Proxy Registry with Replicated Installers
69

7-
This topic describes how to use the Replicated proxy registry with applications deployed with Replicated KOTS.
10+
This topic describes how to use the Replicated proxy registry for applications deployed with Replicated installers (Embedded Cluster, KOTS existing cluster, or kURL).
811

9-
## Overview
12+
## Configure Your Application to Use the Proxy Registry
1013

11-
Replicated KOTS automatically creates the required image pull secret for accessing the Replicated proxy registry during application deployment. When possible, KOTS also automatically rewrites image names in the application manifests to the location of the image at `proxy.replicated.com` or your custom domain.
14+
:::note
15+
These steps assume that you package your application with Helm and that you install with the KOTS HelmChart v2 custom resource.
1216

13-
### Image Pull Secret
17+
If you are installing with the HelmChart v1 custom resource, or if your application is not packaged with Helm, there are different steps for configuring your application to use the proxy registry. See [Other Scenarios](#other-scenarios) below.
18+
:::
1419

15-
During application deployment, KOTS automatically creates an `imagePullSecret` with `type: kubernetes.io/dockerconfigjson` that is based on the customer license. This secret is used to authenticate with the proxy registry and grant proxy access to private images.
20+
To configure your application to use the proxy registry:
1621

17-
For information about how Kubernetes uses the `kubernetes.io/dockerconfigjson` Secret type to authenticate to a private image registry, see [Pull an Image from a Private Registry](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) in the Kubernetes documentation.
22+
1. <StepCreds/>
1823

19-
### Image Location Patching (Standard Manifests and HelmChart v1)
24+
1. <StepCustomDomain/>
2025

21-
For applications packaged with standard Kubernetes manifests (or Helm charts deployed with the [HelmChart v1](/reference/custom-resource-helmchart) custom resource), KOTS automatically patches image names to the location of the image at at `proxy.replicated.com` or your custom domain during deployment. If KOTS receives a 401 response when attempting to load image manifests using the image reference from the PodSpec, it assumes that this is a private image that must be proxied through the proxy registry.
26+
1. <RewriteHelmValues/>
2227

23-
KOTS uses Kustomize to patch the `midstream/kustomization.yaml` file to change the image name during deployment to reference the proxy registry. For example, a PodSpec for a Deployment references a private image hosted at `quay.io/my-org/api:v1.0.1`:
28+
1. <InjectPullSecret/>
2429

25-
```yaml
26-
apiVersion: apps/v1
27-
kind: Deployment
28-
metadata:
29-
name: example
30-
spec:
31-
template:
32-
spec:
33-
containers:
34-
- name: api
35-
image: quay.io/my-org/api:v1.0.1
36-
```
30+
1. Repeat steps 3 and 4 for each Helm chart used by your application.
31+
32+
1. <AdditionalNs/>
33+
34+
1. Create a new release with your changes. Promote the release to a development channel. See [Managing Releases with Vendor Portal](releases-creating-releases).
35+
36+
1. Install in a development environment to test your changes.
3737

38-
When this application is deployed, KOTS detects that it cannot access
39-
the image at quay.io. So, it creates a patch in the `midstream/kustomization.yaml`
40-
file that changes the image name in all manifest files for the application. This causes the container runtime in the cluster to use the proxy registry to pull the images, using the license information provided to KOTS for authentication.
38+
## Other Scenarios
4139

42-
```yaml
43-
apiVersion: kustomize.config.k8s.io/v1beta1
44-
bases:
45-
- ../../base
46-
images:
47-
- name: quay.io/my-org/api:v1.0.1
48-
newName: proxy.replicated.com/proxy/my-kots-app/quay.io/my-org/api
49-
```
40+
If you are installing with the HelmChart v1 custom resource, or if your application is not packaged with Helm, there are different steps for configuring your application to use the proxy registry.
5041

51-
## Enable the Proxy Registry
42+
### HelmChart v1 or Standard Manifests
5243

53-
This section describes how to enable the proxy registry for applications deployed with KOTS, including how to ensure that image names are rewritten and that the required image pull secret is provided.
44+
:::note
45+
<Deprecated/>
46+
:::
5447

55-
To enable the proxy registry:
48+
To use the proxy registry with HelmChart v1 or applications packaged with standard manifests:
5649

5750
1. <StepCreds/>
5851

5952
1. <StepCustomDomain/>
6053

61-
1. Rewrite images names to the location of the image at `proxy.replicated.com` or your custom domain. Also, ensure that the correct image pull secret is provided for all private images. The steps required to configure image names and add the image pull secret vary depending on your application type:
54+
1. <AdditionalNs/>
55+
56+
1. For standard manifest-based applications or Helm charts deployed with the [HelmChart v1](/reference/custom-resource-helmchart) custom resource, KOTS automatically rewrites image names and injects image pull secrets during deployment for these application types. No additional configuration is required to rewrite image names.
57+
58+
<details>
59+
<summary>How does KOTS patch image names?</summary>
60+
61+
For applications packaged with standard Kubernetes manifests (or Helm charts deployed with the [HelmChart v1](/reference/custom-resource-helmchart) custom resource), KOTS automatically patches image names to the location of the image at at `proxy.replicated.com` or your custom domain during deployment. If KOTS receives a 401 response when attempting to load image manifests using the image reference from the PodSpec, it assumes that this is a private image that must be proxied through the proxy registry.
62+
63+
KOTS uses Kustomize to patch the `midstream/kustomization.yaml` file to change the image name during deployment to reference the proxy registry. For example, a PodSpec for a Deployment references a private image hosted at `quay.io/my-org/api:v1.0.1`:
64+
65+
```yaml
66+
apiVersion: apps/v1
67+
kind: Deployment
68+
metadata:
69+
name: example
70+
spec:
71+
template:
72+
spec:
73+
containers:
74+
- name: api
75+
image: quay.io/my-org/api:v1.0.1
76+
```
6277
63-
* **HelmChart v2**: For Helm charts deployed with the[ HelmChart v2](/reference/custom-resource-helmchart-v2) custom resource, configure the HelmChart v2 custom resource to dynamically update image names in your Helm chart and to inject the image pull secret that is automatically created by KOTS. For instructions, see [Configure the HelmChart Custom Resource v2](/vendor/helm-native-v2-using).
78+
When this application is deployed, KOTS detects that it cannot access
79+
the image at quay.io. So, it creates a patch in the `midstream/kustomization.yaml`
80+
file that changes the image name in all manifest files for the application. This causes the container runtime in the cluster to use the proxy registry to pull the images, using the license information provided to KOTS for authentication.
6481

65-
* **Standard Manifests or HelmChart v1**: For standard manifest-based applications or Helm charts deployed with the [HelmChart v1](/reference/custom-resource-helmchart) custom resource, no additional configuration is required. KOTS automatically rewrites image names and injects image pull secrets during deployment for these application types.
82+
```yaml
83+
apiVersion: kustomize.config.k8s.io/v1beta1
84+
bases:
85+
- ../../base
86+
images:
87+
- name: quay.io/my-org/api:v1.0.1
88+
newName: proxy.replicated.com/proxy/my-kots-app/quay.io/my-org/api
89+
```
90+
</details>
6691

67-
:::note
68-
<Deprecated/>
69-
:::
92+
1. Create a new release with your changes. Promote the release to a development channel. See [Managing Releases with Vendor Portal](releases-creating-releases).
7093

71-
* **Kubernetes Operators**: For applications packaged with Kubernetes Operators, KOTS cannot modify pods that are created at runtime by the Operator. To support the use of private images in all environments, the Operator code should use KOTS functionality to determine the image name and image pull secrets for all pods when they are created. For instructions, see [Reference Images](/vendor/operator-referencing-images) in the _Packaging Kubernetes Operators_ section.
94+
1. Install in a development environment to test your changes.
7295

73-
1. If you are deploying Pods to namespaces other than the application namespace, add the namespace to the `additionalNamespaces` attribute of the KOTS Application custom resource. This ensures that KOTS can provision the `imagePullSecret` in the namespace to allow the Pod to pull the image. For instructions, see [Define Additional Namespaces](operator-defining-additional-namespaces).
96+
### Kubernetes Operators
7497

75-
1. (Optional) Add a custom domain for the proxy registry instead of `proxy.replicated.com`. See [Use Custom Domains](custom-domains-using).
98+
To use the proxy registry with applications packaged as Kubernetes Operators:
99+
100+
1. <StepCreds/>
101+
102+
1. <StepCustomDomain/>
103+
104+
1. <AdditionalNs/>
105+
106+
1. For standard manifest-based applications or Helm charts deployed with the [HelmChart v1](/reference/custom-resource-helmchart) custom resource, KOTS automatically rewrites image names and injects image pull secrets during deployment for these application types. No additional configuration is required to rewrite image names.
107+
108+
<details>
109+
<summary>How does KOTS patch image names?</summary>
110+
111+
For applications packaged with standard Kubernetes manifests (or Helm charts deployed with the [HelmChart v1](/reference/custom-resource-helmchart) custom resource), KOTS automatically patches image names to the location of the image at at `proxy.replicated.com` or your custom domain during deployment. If KOTS receives a 401 response when attempting to load image manifests using the image reference from the PodSpec, it assumes that this is a private image that must be proxied through the proxy registry.
112+
113+
KOTS uses Kustomize to patch the `midstream/kustomization.yaml` file to change the image name during deployment to reference the proxy registry. For example, a PodSpec for a Deployment references a private image hosted at `quay.io/my-org/api:v1.0.1`:
114+
115+
```yaml
116+
apiVersion: apps/v1
117+
kind: Deployment
118+
metadata:
119+
name: example
120+
spec:
121+
template:
122+
spec:
123+
containers:
124+
- name: api
125+
image: quay.io/my-org/api:v1.0.1
126+
```
127+
128+
When this application is deployed, KOTS detects that it cannot access
129+
the image at quay.io. So, it creates a patch in the `midstream/kustomization.yaml`
130+
file that changes the image name in all manifest files for the application. This causes the container runtime in the cluster to use the proxy registry to pull the images, using the license information provided to KOTS for authentication.
131+
132+
```yaml
133+
apiVersion: kustomize.config.k8s.io/v1beta1
134+
bases:
135+
- ../../base
136+
images:
137+
- name: quay.io/my-org/api:v1.0.1
138+
newName: proxy.replicated.com/proxy/my-kots-app/quay.io/my-org/api
139+
```
140+
</details>
141+
142+
1. For applications packaged with Kubernetes Operators, KOTS cannot modify pods that are created at runtime by the Operator. To support the use of private images in all environments, the Operator code should use KOTS functionality to determine the image name and image pull secrets for all pods when they are created. For instructions, see [Reference Images](/vendor/operator-referencing-images) in the _Packaging Kubernetes Operators_ section.

0 commit comments

Comments
 (0)