I successfully deployed k8s pod with service of type NodePort in microk8s cluster. Now when I enable ufw and try to deny incoming traffic to the exposed port 31001 using command ```ufw deny 31001``` , ufw still allows traffic to port 31001.
What should I do in ufw to allow and deny traffic to port 31001 ?
I believe you're "fighting" against the internal Docker network used for the microk8s instancees. I've come across different options, from setting up after rules for ufw to disabling the docker ip tables configuration. The nicest setup in my opinion seems to be this: https://github.com/chaifeng/ufw-docker#how-to-do
Edit: it can also be inherent to NodePort, see per comment on SO: https://stackoverflow.com/questions/62772319/ufw-not-blocking-traffic-to-microk8s-cluster#comment112367622_62772319