Mark:
Hello,
I’m working on Ingress labs, I’ve created a deny network policy in default namespace but still traffic is allowed.
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: NetworkPolicy
metadata:
name: default-deny-ingress
namespace: default
spec:
podSelector: {}
policyTypes:
- Ingress
root@controlplane:~# kubectl get pods,svc,ep
NAME READY STATUS RESTARTS AGE
pod/app 1/1 Running 0 17m
pod/foo 1/1 Running 1 15m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/app ClusterIP 10.108.159.88 <none> 80/TCP 17m
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 44m
NAME ENDPOINTS AGE
endpoints/app 10.244.0.4:80 17m
endpoints/kubernetes 10.29.118.9:6443 44m
root@controlplane:~# kubectl get netpol -A
NAMESPACE NAME POD-SELECTOR AGE
default default-deny-ingress <none> 5m24s
When I’m trying to access cluster ip from a test pod, it’s actually accessible.
root@controlplane:~# kubectl exec -it foo -- sh
/ # telnet 10.108.159.88 80
Connected to 10.108.159.88
Could any one suggest what’s actually wrong here?
@Mumshad Mannambeth@Vijin Palazhi