Kubernetes NetworkPolicies refused connection Kubernetes NetworkPolicies refused connection kubernetes kubernetes

Kubernetes NetworkPolicies refused connection


As mentioned in kubernetes documentation about Network Policy

Prerequisites

Network policies are implemented by the network plugin. To use network policies, you must be using a networking solution which supports NetworkPolicy. Creating a NetworkPolicy resource without a controller that implements it will have no effect.

As far as I know flannel, which is used by katacoda does not support network policy.

controlplane $ kubectl get pods --namespace kube-systemNAME                                      READY   STATUS    RESTARTS   AGEcoredns-66bff467f8-4tmhm                  1/1     Running   0          16mcoredns-66bff467f8-v2dbj                  1/1     Running   0          16metcd-controlplane                         1/1     Running   0          16mkatacoda-cloud-provider-58f89f7d9-brnk2   1/1     Running   8          16mkube-apiserver-controlplane               1/1     Running   0          16mkube-controller-manager-controlplane      1/1     Running   0          16mkube-flannel-ds-amd64-h5lrd               1/1     Running   1          16mkube-flannel-ds-amd64-sdl4b               1/1     Running   0          16mkube-keepalived-vip-gkhbz                 1/1     Running   0          16mkube-proxy-6gd8d                          1/1     Running   0          16mkube-proxy-zkldz                          1/1     Running   0          16mkube-scheduler-controlplane               1/1     Running   1          16m

As mentioned here

Flannel is focused on networking. For network policy, other projects such as Calico can be used.

Additionally there is nice tutorial which show which CNI support network policy.

enter image description here

So I would say it´s not possible to do on katacoda playground.