|
1 | 1 | import Deprecated from "../partials/helm/_replicated-deprecated.mdx" |
2 | 2 | import StepCreds from "../partials/proxy-service/_step-creds.mdx" |
3 | 3 | 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" |
4 | 7 |
|
5 | | -# Use the Proxy Registry with KOTS Installations |
| 8 | +# Use the Proxy Registry with Replicated Installers |
6 | 9 |
|
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). |
8 | 11 |
|
9 | | -## Overview |
| 12 | +## Configure Your Application to Use the Proxy Registry |
10 | 13 |
|
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. |
12 | 16 |
|
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 | +::: |
14 | 19 |
|
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: |
16 | 21 |
|
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/> |
18 | 23 |
|
19 | | -### Image Location Patching (Standard Manifests and HelmChart v1) |
| 24 | +1. <StepCustomDomain/> |
20 | 25 |
|
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/> |
22 | 27 |
|
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/> |
24 | 29 |
|
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. |
37 | 37 |
|
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 |
41 | 39 |
|
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. |
50 | 41 |
|
51 | | -## Enable the Proxy Registry |
| 42 | +### HelmChart v1 or Standard Manifests |
52 | 43 |
|
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 | +::: |
54 | 47 |
|
55 | | -To enable the proxy registry: |
| 48 | +To use the proxy registry with HelmChart v1 or applications packaged with standard manifests: |
56 | 49 |
|
57 | 50 | 1. <StepCreds/> |
58 | 51 |
|
59 | 52 | 1. <StepCustomDomain/> |
60 | 53 |
|
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 | + ``` |
62 | 77 |
|
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. |
64 | 81 |
|
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> |
66 | 91 |
|
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). |
70 | 93 |
|
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. |
72 | 95 |
|
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 |
74 | 97 |
|
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