Prerequisites
- Aviatrix Controller 8.2 or later
- CoPilot 4.31 or later
- DCF for Kubernetes enabled with Log Enrichment turned on
- A cloud account onboarded in CoPilot for the cloud provider hosting the Kubernetes cluster
- AI agent workloads deployed as Kubernetes pods (LangGraph, AutoGen, CrewAI, or a custom runtime)
Procedure
- CoPilot UI
- Terraform
1
Deploy an Aviatrix spoke gateway in the cluster VPC
An Aviatrix spoke gateway in the same VPC as your Kubernetes cluster is the
enforcement point where the Aviatrix controller applies containment policy to
MCP server egress traffic.
- In CoPilot, navigate to Cloud Fabric > Gateways > Spoke Gateways and click + Spoke Gateway.
-
Provide the following details:
- In the Instances section, select a subnet in the cluster VPC for the gateway instance.
- Click Save.
2
Install the Aviatrix Kubernetes Firewall Helm chart
The Aviatrix Kubernetes Firewall Helm chart deploys the in-cluster components
that allow the Aviatrix controller to reconcile and enforce containment policies
on the cluster.Run the following command against the target cluster, replacing
<chart-version> with the current chart version from the
Aviatrix k8s-firewall-charts repository:3
Verify Aviatrix CRD installation
The Helm chart installs two Aviatrix CRDs on the cluster. Verify both are
present before continuing:Expected output:If either CRD is missing, re-run the Helm installation and check the output for
errors.
4
Onboard the Kubernetes cluster to Aviatrix DCF
- Navigate to Cloud Resources > Cloud Assets > Kubernetes Clusters.
- Click Onboard next to the target cluster.
-
Choose the appropriate access method for your cloud provider:
- AWS (EKS): Select Terraform or Command Line, apply the generated access entry and RBAC configuration, check the confirmation box, then click Onboard.
- Azure (AKS): Select Permissions on Cloud Account if the Aviatrix service principal has the required permissions, or Kubeconfig File to upload a kubeconfig. Click Onboard.
- Wait for the cluster status to show Yes (green) on the Kubernetes Clusters tab.
EKS clusters require a
view-nodes ClusterRole so the Controller can discover
node metadata. The CoPilot onboarding dialog generates the required YAML
automatically — apply it before clicking Onboard.5
Label agent pods
Aviatrix containment policies target pods by Kubernetes label selector. Ensure
each agent Deployment includes a label that uniquely identifies the agent
workload.The following example uses Use a consistent label scheme across your agent fleet, for example
app: research-agent:agent: <name> or app: <name>. The same label is referenced in the
containment policy in the next step.6
Author a containment policy for each agent
A Apply the policy:Repeat for each agent workload, adjusting the
FirewallPolicy resource defines the allowed egress destinations for pods
matching a label selector. Create one policy per agent workload and commit it to
the same repository as the agent’s Deployment manifest.The following example permits pods labelled app: research-agent in the
ai-agents namespace to reach a model provider API and a single tool endpoint.
All other egress is denied.name, matchLabels selector,
and domains list to match that agent’s identity and permitted destinations.Commit the
FirewallPolicy manifest to the same directory as the agent’s
Deployment. This ensures it travels through the same review, CI/CD, and
rollback process as the workload definition it protects.7
Verify containment
-
Check policy events to confirm the policy was applied successfully:
A successful apply produces an event with
Reason: UpdatePolicyListSuccess. - Navigate to Security > Distributed Cloud Firewall and select the cluster. Confirm the policy appears with the correct egress allow-list for each agent.
- Invoke the agent and confirm that connections to declared destinations appear as PERMIT events in CoPilot FlowIQ.
-
To verify egress blocking, attempt a connection from an agent pod to a
destination not in its
domainslist and confirm it is denied. The denied attempt appears in CoPilot per-connection logs alongside the agent’s allowed traffic.