Usage of K8S labels

This may be a silly question, but i’m confused by the usage of K8S labels for long

candidate@node01:~$ kubectl get ns qaqa --show-labels
NAME   STATUS   AGE   LABELS
qaqa   Active   71d   kubernetes.io/metadata.name=qaqa,name=qaqa

See above, ns qaqa has two labels assigned, what is the major difference? Is that ok to match label “kubernetes.io/metadata.name=qaqa” while developing a netpol? Or i’m able to use either of them?

You can use either label. The label kubernetes.io/metadata.name=qaqa is created for you automatically, but it works like any other label, and you can use it for selecting the namespace, for network policies, or anything else. But you can select with either of those two labels, or both of them.

1 Like

Thanks for your prompt response & clarification, Rob :grinning: