My namespace has some custom metadata labels. Some have the labels some don't. Is there any way to get the namespaces which has a particular label using kubectl?
Yes. Like so:
$ kubectl create ns nswithlabels
$ kubectl label namespace nswithlabels this=thing
$ kubectl describe ns/nswithlabels
Name: nswithlabels
Labels: this=thing
Annotations: <none>
Status: Active
No resource quota.
No resource limits.
$ kubectl get ns -l=this
NAME STATUS AGE
nswithlabels Active 6m
Note: I could have also used -l=this=thing
in the last command to specify both key and value required to match.