Skip to main content
When complete, each self-hosted MCP server will have a workload-scoped containment policy committed alongside its Kubernetes manifests and enforced at the VPC boundary by the Aviatrix controller. Containment policies travel through the same CI/CD pipeline, version control, and review process as the server definitions they protect. For the business case and architecture overview, see MCP Server Security Through Containment Architecture.

Prerequisites

Procedure

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.
  1. In CoPilot, navigate to Cloud Fabric > Gateways > Spoke Gateways and click + Spoke Gateway.
  2. Provide the following details:
  3. In the Instances section, select a subnet in the cluster VPC for the gateway instance.
  4. Click Save.
Wait for the gateway status to show Up before continuing. You can monitor progress at CoPilot > Monitor > Notifications > Tasks.
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

  1. Navigate to Cloud Resources > Cloud Assets > Kubernetes Clusters.
  2. Click Onboard next to the target cluster.
  3. 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.
  4. 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 MCP server pods

Aviatrix containment policies target pods by Kubernetes label selector. Ensure each MCP server Deployment includes a unique, consistent label that identifies the server.The following example uses app: github-mcp-server:
Use a label scheme that uniquely identifies each MCP server, for example mcp-server: github or app: <server-name>. The same label is referenced in the containment policy in the next step.
6

Author a containment policy for each MCP server

A FirewallPolicy resource defines the allowed egress destinations for pods matching a label selector. Create one policy per MCP server and commit it to the same repository as the server’s Deployment manifest.The following example permits pods labelled app: github-mcp-server in the mcp-servers namespace to reach only api.github.com. All other egress is denied.
Apply the policy:
Repeat for each MCP server, adjusting the name, matchLabels selector, and domains list to match that server’s identity and permitted destinations.
Commit the FirewallPolicy manifest to the same repository directory as the server’s Deployment. This ensures it travels through the same review, CI/CD, and rollback process as the server definition it protects.
7

Verify containment

  1. Check policy events to confirm the policy was applied successfully:
    A successful apply produces an event with Reason: UpdatePolicyListSuccess.
  2. Navigate to Security > Distributed Cloud Firewall and select the cluster. Confirm the policy appears with the correct egress allow-list for each MCP server.
  3. To confirm egress blocking is active, attempt a connection from an MCP server pod to a destination not in its domains list and verify it is denied. The denied attempt appears in CoPilot per-connection logs alongside the server’s allowed traffic.