Answer a question

I've followed a Kubernetes tutorial similar to: https://kubernetes.io/docs/tasks/administer-cluster/declare-network-policy/ which created some basic networkpolicies as follows:

root@server:~# kubectl get netpol -n policy-demo
NAME           POD-SELECTOR   AGE
access-nginx   run=nginx      49m
default-deny   <none>         50m

I saw that I can delete the entire namespace (pods included) using a command like "kubectl delete ns policy-demo", but I can't see what command I need to use if I just want to delete a single policy (or edit it even).

How would I use kubectl to delete just the "access-nginx" policy above?

Answers

This should work. A similar command works at my end.

kubectl -n policy-demo delete networkpolicy access-nginx
Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐