Skip to content

Create a Network Policy ​

Set policies to allow or deny network traffic between Pods.

Prerequisites

  • The cluster must have a CNI plugin that supports Network Policy (e.g., Calico, Cilium).
  • Note the labels of the Pods to which the policy will apply.

INFO

Without a Network Policy, all traffic between Pods is allowed. Once any policy is applied, only explicitly permitted traffic passes through.


Step 1. Open the Create Network Policy form ​

Select Policy → Network policies from the left sidebar. Click the Create network policy button in the top right.


Step 2. Enter basic information ​

FieldDescriptionExample
NameNetwork Policy nameallow-frontend-to-backend
NamespaceTarget namespacedefault

Step 3. Configure Pod Selector ​

Select the Pods this policy applies to using labels.

KeyValue
appbackend

Leave blank to apply to all Pods in the namespace.


Step 4. Configure Ingress (inbound) rules ​

Define what incoming traffic this Pod can receive.

Click Add Ingress Rule.

Configure From (allowed sources) ​

Source TypeDescriptionExample
Pod SelectorAllow only from Pods with specific labelsapp: frontend
Namespace SelectorAllow only from Pods in specific namespacesteam: platform
IP BlockAllow only from specific CIDR ranges10.0.0.0/24

Configure Ports (allowed ports) ​

FieldDescriptionExample
ProtocolTCP or UDPTCP
PortAllowed port number8080

Step 5. Configure Egress (outbound) rules ​

To restrict outgoing traffic from Pods, click Add Egress Rule.

Specify the allowed destinations in the To section. If no Egress rules are set, all outbound traffic is allowed.


Step 6. Confirm creation ​

Click Create. Verify the created policy in the Network policies list.

The policy takes effect immediately on the selected Pods.


Next Steps ​

The New Standard for AI Infrastructure