Skip to main content

Network Policy

A Network Policy in Kubernetes is used to specify how groups of pods are allowed to communicate with each other and with other network endpoints. It allows for the creation of granular rules to regulate both incoming and outgoing traffic. By defining Network Policies, users can enhance the security by controlling the flow of data and limiting exposure of certain services. For more detailed information, you can refer to the official Kubernetes documentation on Network Policies.

Terraform Mappings:

  • kubernetes_network_policy.metadata[0].name
  • kubernetes_network_policy_v1.metadata[0].name

Supported Methods​

  • GET
  • LIST
  • SEARCH

Pod​

A Network Policy is directly related to Pods as it defines the network access to and from groups of pods in a Kubernetes cluster. The rules specified within a Network Policy determine which pods are allowed to communicate with other pods and resources, thus influencing the connectivity and isolation behaviour of the Pods.