Skip to main content

Egress Proxy for Argo CD Instances

If your Argo CD instances need a corporate proxy to reach external hosts, such as Git providers, Helm or OCI registries and SCM provider APIs, you can set the proxy environment variables on the instance components with instanceValues.kustomization. This page describes which components need the proxy and how to keep the instance's internal traffic off the proxy.

Which components need the proxy​

  • argocd-repo-server connects to your Git repositories and Helm or OCI registries, including the repositories read by ApplicationSet Git generators.
  • argocd-applicationset-controller only connects to external hosts for the SCM provider and pull request generators (including GitHub App authentication), and the plugin generator calls your plugin's service URL. If you don't use these generators against external hosts, the ApplicationSet controller doesn't need the proxy.

Excluding the instance's internal endpoints​

The components of each instance run in the namespace argocd-<instanceId> and reach the instance's API server at k3s-proxy.argocd-<instanceId>. This hostname is different for every instance, so a static NO_PROXY can't exclude it:

  • CIDR entries such as 10.0.0.0/8 only match requests to IP addresses, not hostnames.
  • The per-instance part is the last label of the hostname, so no shared domain suffix matches all instances.

If this request goes through the proxy, the ApplicationSet controller fails to list cluster secrets, for example with Moved Temporarily (an HTTP 302 from the proxy):

failed to list *v1.Secret: Get "https://k3s-proxy.argocd-<instanceId>:6445/api/v1/namespaces/argocd/secrets?...": Moved Temporarily

The ApplicationSet controller already has a NAMESPACE environment variable set to its own namespace, and Kubernetes expands $(NAMESPACE) in environment variables defined after it. Adding $(NAMESPACE) to NO_PROXY therefore gives every instance its own argocd-<instanceId> entry, which also matches k3s-proxy.argocd-<instanceId>:

instanceValues:
kustomization:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
patches:
- target:
kind: Deployment
name: argocd-applicationset-controller
patch: |-
- op: add
path: /spec/template/spec/containers/0/env/-
value: {name: HTTPS_PROXY, value: "http://<proxy>:<port>"}
- op: add
path: /spec/template/spec/containers/0/env/-
value: {name: HTTP_PROXY, value: "http://<proxy>:<port>"}
- op: add
path: /spec/template/spec/containers/0/env/-
value: {name: NO_PROXY, value: "<your existing NO_PROXY>,$(NAMESPACE)"}
note

Keep $(NAMESPACE) exactly as written, and append the variables to the end of the env list (as above). Kubernetes only expands $(NAMESPACE) when NO_PROXY is defined after NAMESPACE.

instanceValues.kustomization applies to all Argo CD instances, so add your other proxy settings, such as the patch for argocd-repo-server, to the same kustomization.

Verifying the configuration​

After the change is rolled out, check that NO_PROXY in the ApplicationSet controller ends with the instance's namespace:

kubectl -n argocd-<instanceId> exec deploy/argocd-applicationset-controller -- sh -c 'echo $NO_PROXY'

The output should end with ,argocd-<instanceId>, and the controller logs should no longer show Moved Temporarily errors for k3s-proxy.