> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aviatrix.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Secure Kubernetes Workloads Through Identity-Based Egress Policy

> How Aviatrix applies identity-based egress control to Kubernetes clusters on EKS, AKS, GKE, and custom platforms, covering the business case and key components.

Kubernetes is the platform that many teams use to run applications as
containers. A cluster is the group of machines that runs them, and a pod is the
small unit that holds an application's containers and often exists for only
minutes. That changes the unit of security from a server with a fixed IP address
to a short-lived workload. Aviatrix applies the same identity-based policy model
to clusters that it applies to virtual machines, so platform and security teams
share one set of controls.

## Business Challenge

Many Kubernetes security tools either add software beside every application
(known as a sidecar) or replace the cluster's networking layer (the CNI plugin).
Both choices tie your security model to one platform decision and add cost that
grows with the number of workloads. Outbound traffic from a cluster usually
leaves through the machine that runs the workload, so the address that a
destination sees identifies that machine rather than the application. As a
result, you cannot write a rule for what one team's application is allowed to
reach.

## The Business Case for Kubernetes Workload Security

### Risk Mitigation

* **Egress control by application and team.** Rules apply to a namespace (the
  part of a cluster that a team or application uses), a pod, or a whole cluster,
  and describe what a workload is allowed to reach instead of which machine it
  runs on.
* **Domain-based filtering at the boundary.** A compromised workload can reach
  only the destinations that policy permits.
* **Unsafe rules rejected before they land.** An admission policy engine, which
  checks each change before the cluster accepts it, can block a rule such as a
  permit to every address (`0.0.0.0/0`).
* **Accountable change.** Teams review each policy change in Git, the
  version-control system, so every change is auditable.

### Operational Efficiency

* **No extra software in every workload.** Gateways enforce egress policy at the
  VPC or VNet boundary instead of a sidecar beside each application, so cost
  does not grow with the number of workloads.
* **Policy as code.** Developers and security engineers write rules in the same
  kind of configuration files that they use to deploy applications, and review
  them like code.
* **One engine for every workload.** Rules, WebGroups, and logging stay
  consistent across Kubernetes and non-Kubernetes workloads.

### Strategic Value

* **Platform independence.** The same model covers Amazon EKS, Azure AKS, Google
  GKE, and clusters that you run yourself, so a platform decision does not
  dictate your security model.
* **Shared ownership.** Platform and security teams work from one set of
  controls instead of two.

## How Aviatrix Addresses Kubernetes Risk

You connect a cluster to the Aviatrix Controller, a step called onboarding, and
define egress policy for its workloads. Distributed Cloud Firewall (DCF) then
controls traffic from the cluster to destinations outside the VPC or VNet, where
Aviatrix gateways enforce it. DCF for Kubernetes applies to traffic that leaves
the VPC or VNet only. For traffic between pods inside a cluster, DCF can
translate rules into Kubernetes NetworkPolicy objects, the built-in Kubernetes
traffic rules, which the cluster's networking plugin (CNI) enforces.

![Kubernetes workload security architecture: FirewallPolicy and WebgroupPolicy custom resources are reconciled by the Aviatrix Controller into SmartGroups and Distributed Cloud Firewall rules, which an Aviatrix Spoke Gateway enforces on pod egress leaving the VPC or VNet, permitting declared destinations and denying the rest, while traffic between pods inside a cluster uses Kubernetes network rules enforced by the cluster networking plugin.](https://mintcdn.com/aviatrix-14b37c43/fGohijthCmM99wVL/images/solutions/secure-kubernetes-workloads/kubernetes-containment-architecture.png?fit=max\&auto=format\&n=fGohijthCmM99wVL\&q=85\&s=0d76dbf72ed069f6589b498c77852d44)

*Custom resources become DCF rules that a Spoke gateway enforces on pod egress.*

### Onboard Clusters

Aviatrix supports Amazon EKS, Azure AKS, and Google GKE, which are the managed
Kubernetes services of each cloud. It also supports custom clusters that you run
yourself, and private clusters whose management endpoint (the API server) is not
exposed to the public internet.

### Define Policy With Kubernetes Resources

The `FirewallPolicy` and `WebgroupPolicy` custom resource definitions (CRDs) add
Aviatrix policy objects to Kubernetes. You manage egress rules with `kubectl`,
the standard Kubernetes command-line tool, or with a GitOps pipeline, in which
Git is the source of truth for configuration. Kubernetes role-based access
control (RBAC) controls who can change policy, and an admission policy engine
such as OPA/Gatekeeper or Kyverno rejects unsafe rules.

## Key Components

> [card] [DCF for Kubernetes](https://docs.aviatrix.com/docs/enterprise/10.1/guides/security/dcf/dcf-kubernetes.md)
>
> Identity-based egress policy for namespaces, pods, and services across EKS,
> AKS, GKE, and custom clusters.

> [card] [Kubernetes CRDs](https://docs.aviatrix.com/docs/enterprise/10.1/reference/dcf/kubernetes-crd-reference.md)
>
> The `FirewallPolicy` and `WebgroupPolicy` resources for policy as code.

> [card] [SmartGroups](https://docs.aviatrix.com/docs/enterprise/10.1/concepts-architectures/components/dcf/smartgroups-about.md)
>
> Identity-based selectors that your Kubernetes policy references.

> [card] [WebGroups](https://docs.aviatrix.com/docs/enterprise/10.1/concepts-architectures/components/dcf/webgroups-about.md)
>
> Domain allow-lists for outbound pod traffic.

## Related Documentation

Use these documents to plan and implement Kubernetes egress control.

### Configuration Guides

* [Distributed Cloud Firewall for Kubernetes](https://docs.aviatrix.com/docs/enterprise/10.1/guides/security/dcf/dcf-kubernetes.md)
  — overview, prerequisites, and workflow.
* [Onboard an Amazon EKS Cluster](https://docs.aviatrix.com/docs/enterprise/10.1/guides/security/dcf/kubernetes-onboard-eks.md)
* [Onboard an Azure AKS Cluster](https://docs.aviatrix.com/docs/enterprise/10.1/guides/security/dcf/kubernetes-onboard-aks.md)
* [Onboard a Google GKE Cluster](https://docs.aviatrix.com/docs/enterprise/10.1/guides/security/dcf/kubernetes-onboard-gke.md)
* [Onboard a Custom Kubernetes Cluster](https://docs.aviatrix.com/docs/enterprise/10.1/guides/security/dcf/kubernetes-onboard-custom.md)
* [Onboard a Private Kubernetes Cluster](https://docs.aviatrix.com/docs/enterprise/10.1/guides/security/dcf/private-kubernetes-cluster-onboard.md)
* [Kubernetes Resource Discovery](https://docs.aviatrix.com/docs/enterprise/10.1/guides/security/dcf/kubernetes-resource-discovery.md)
  — discover Kubernetes resources in your cloud accounts.

### Reference

* [Kubernetes CRD Reference](https://docs.aviatrix.com/docs/enterprise/10.1/reference/dcf/kubernetes-crd-reference.md)
  — fields for `FirewallPolicy` and `WebgroupPolicy`, plus RBAC and GitOps
  guidance.
* [Kubernetes Prerequisites](https://docs.aviatrix.com/docs/enterprise/10.1/reference/dcf/kubernetes-prerequisites.md)
  — cluster and network requirements.
* [Distributed Cloud Firewall Capabilities](https://docs.aviatrix.com/docs/enterprise/10.1/reference/dcf/dcf-capabilities.md)
  — supported capabilities by Controller version.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.