Shashikant shah

Monday, 14 December 2020

Labels and multiple labels Part-05

How to add lable for pods in yaml file.









# kubectl apply -f firstpods.yaml 

# kubectl get pods -o wide --show-labels

# kubectl get pods --show-labels



How to add lable though command.

# kubectl label pod <pod_name>  <env=testing>

# kubectl get pods --show-labels



Multiple label add for pods in yaml file.






How to edit/replace name “env=testing” label to “env=prod” label.

# kubectl edit pods nginxpod

# kubectl label --overwrite pod nginxpod env=prod

How to delete “env=testing” label.

# kubectl label pod nginxpod env-

How to add label for all pods.

# kubectl  label --all status=xyz





No comments:

Post a Comment