Home > other >  Kubernetes: cannot see network policies created with calico
Kubernetes: cannot see network policies created with calico

Time:06-29

apiVersion: projectcalico.org/v3
kind: NetworkPolicy

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy

By using kubectl get networkpolicy, I can see only the policies created by networking.k8s.io/v1 and not those created by projectcalico.org/v3. Any suggestion how to see the latter ones?

CodePudding user response:

kubectl get XXX does not display all the resources in the cluster, in your case you cannot see CRD

  • You can find your object with kubectl get crds
  • Then kubectl get <crd name> -A

In your case it would be:

# Get all the CRD from the desired type
kubectl get projectcalico.org/v3 -A

# Now grab the desired name and do whatever you want with it
kubectl describe <CRD>/<resource name> -n <namespace>

enter image description here

enter image description here

  • Related