Computer scienceSystem administration and DevOpsKubernetes

Ingress and Egress Network Policies

Theory

Make it happen

Report a typo

Consider a scenario where an application is deployed within a Kubernetes cluster, comprising three distinct components: frontend, backend, and a database. The Pod definition manifests for these pods are:

Assume default deny all NetworkPolicy has already been created in the test namespace, we would like to achieve the following configuration:

  • frontend pod should be allowed to communicate with the backend pod only.
  • backend pod should be allowed to communicate with the database pod and the frontend pod.
  • database pod should be allowed to communicate with the backend pod only.

networkpolicy image for task

Create NetworkPolcies for each of these pods to achieve the scenario described above.

Hints:

  • Please use the IP addresses (shown in the image above) of pods to define the the ingress and the egress rules for the NetworkPolicies.
  • Remember in the context of defining ingress or egress for a pod in Kubernetes NetworkPolicy, the ports field contains the port attribute. this port attribute in the context of ingress refers to the recipient's port while the port attribute in the context of egress refers to the destination's port.
  • To define multiple manifests within a single YAML file, utilize the --- separator line between each manifest. This separator acts as a delimiter, allowing you to include several Kubernetes resource definitions, such as deployments, services, or config maps, in a single YAML document.
Enter a short text
___

Create a free account to access the full topic