OpsCanary
kubernetesnetworkingPractitioner

Automate Proxy Injection in EKS Fargate with Kyverno

5 min read AWS Containers BlogSep 1, 2026Reviewed for accuracy
Share
PractitionerHands-on experience recommended

In a world where cloud-native applications need to communicate securely and efficiently, managing proxy settings can become a cumbersome task. Manually adding proxy environment variables to each container in your deployment manifests is not only error-prone but also time-consuming. Automating this process with Kyverno allows you to enforce consistent proxy settings across your pods, enhancing security and simplifying your deployment workflow.

Kyverno operates as a mutating admission webhook within your Kubernetes cluster. When a pod creation request is made, the API server sends an AdmissionReview to Kyverno. If the pod's namespace is labeled with proxy-injection: enabled, Kyverno injects the necessary HTTPS_PROXY, HTTP_PROXY, and NO_PROXY environment variables into every container and init container at admission time. This means that your applications will start with the correct proxy settings already in place, allowing them to route outbound calls through the corporate proxy without additional configuration. The failurePolicy: Ignore setting ensures that pod scheduling is not blocked if the webhook is temporarily unavailable, maintaining your deployment's reliability.

In production, ensure that your Fargate profiles are correctly configured to match CoreDNS, Kyverno, and any other pods you schedule. Be aware that while CIDR ranges in NO_PROXY are honored by some clients, others like curl and libcurl may not behave as expected. This can lead to unexpected behavior if your applications rely on these tools for outbound communication. Always verify your proxy settings and test your applications thoroughly to avoid connectivity issues.

Key takeaways

  • Leverage Kyverno's MutatingPolicy to automate proxy injection for EKS Fargate pods.
  • Use the `proxy-injection: enabled` label to trigger automatic environment variable injection.
  • Configure `failurePolicy: Ignore` to prevent deployment issues during webhook outages.
  • Be cautious of NO_PROXY behavior across different clients, especially with curl and libcurl.
  • Ensure Fargate profiles are correctly set up to avoid pending states for your pods.

Why it matters

Automating proxy injection reduces manual errors and saves time, allowing your team to focus on building features rather than managing configurations. This consistency enhances security by ensuring all outbound traffic is routed through the corporate proxy.

Code examples

YAML
One MutatingPolicy of roughly 30 lines of YAML covers each pod in a labeled namespace, instead of three environment variables added by hand to each container in each deployment manifest.

When NOT to use this

The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.

Want the complete reference?

Read official docs

Test what you just learned

Quiz questions written from this article

Take the quiz →
Linux FoundationSponsor

Industry-standard certifications built by the people behind Linux and Kubernetes. Earn the CKA — the gold standard Kubernetes administrator cert. OpsCanary readers get 30% off year-round with code OPSCANARY3.

Get CKA certified →

Get the daily digest

One email. 5 articles. Every morning.

No spam. Unsubscribe anytime.