LinuxCommandLibrary

kubectl-label

Edit Kubernetes resources.

TLDR

Label a pod

$ kubectl label pod [pod_name] [key]=[value]
copy


Update a pod label by overwriting the existing value
$ kubectl label --overwrite [pod_name] [key]=[value]
copy


Label all pods in the namespace
$ kubectl label pods --all [key]=[value]
copy


Label pod identified by pod definition file
$ kubectl label -f [pod_defination_file] [key]=[value]
copy


Remove the label from a pod
$ kubectl label pod [pod_name] [key]-
copy

Copied to clipboard