Member-only story

K8s — Network Policy Introduction

Tony
6 min readFeb 7, 2024

What is K8s Network Policy

A Kubernetes network policy is a specification of how groups of pods are allowed to communicate with each other and other network endpoints.

Some key concepts of Kubernetes network policy are:

  • Pod Isolation: By default, pods in a Kubernetes cluster can communicate with each other without any restrictions. Network policies are used to enforce isolation between pods, restricting access only to those allowed explicitly.
  • Define Traffic Rules: Network policies allow you to define rules that govern the ingress (incoming) and egress (outgoing) traffic of pods. You can specify which pods are allowed to communicate and on which ports.
  • Label-Based Selection: Policies target pods using selectors based on labels. This means you can apply policies to a group of pods that share a particular label, making the policies dynamic and easy to manage.
  • Declarative Configuration: Like other Kubernetes resources, network policies are defined declaratively, typically in YAML format. This aligns with the Kubernetes philosophy of declaring the desired state of the system.
  • Enforcement by Network Plugins: The enforcement of network policies is handled by the network plugin of the Kubernetes cluster. Not all network…

--

--

Tony
Tony

No responses yet