Edith Puclla:
I am running this command to create a deploy. After created it, I look on the labels and I have: "Labels: app=foo " , why the label is “app” if I didn’t specify nothing about labels on my command?
kubectl create deploy foo --image=dgkanatsios/simpleapp --port=8080 --replicas=3
Dhawan Shringi:
The command adds the label by default based on the deployment name.
Edith Puclla:
I see, this will always be: “app=” if I don’t set any label, correct?
Fernando Jimenez:
For deployments the kubectl create
does not allow to pass it any labels, therefore it will always generate the app=name-of-deployment
Edith Puclla:
I see , is it possible change a label of a deployment with imperative commands?
Tej_Singh_Rana:
Yes, you can use kubectl label
command.
Tej_Singh_Rana:
app=foo
First remove it,
kubectl label deploy foo app-
Hyphen(-) Sign -> To remove the existing label.
then add new label,
kubectl label deploy foo key=value
Edith Puclla:
Thank you @Tej_Singh_Rana