How to rename deployments in Kubernetes

0 votes

I'm trying to change my deployments name:

$ kubectl get deployments
NAME                  DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
analytics-rethinkdb   1         1         1            1           18h
frontend              1         1         1            1           6h
queue                 1         1         1            1           6h

I tried editing the deployment file but it is not changing the name of it:

$ kubectl edit deployments/analytics-rethinkdb
error: metadata.name should not be changed

I know I can delete the deployment and then redeploy it with the changed name but still I think it should be possible to change its name.

Dec 4, 2018 in Kubernetes by Damon Salvatore
• 5,510 points
726 views

2 answers to this question.

0 votes

I'm sorry, but object names in kubernetes cannot be changed. They're immutable. You'd have to delete and deploy the Deployment with a different name to get what you want.

answered Dec 4, 2018 by DareDev
• 6,810 points
0 votes
Hey, You can edit or recreate it with a different name.
answered Dec 5, 2018 by Maverick
• 10,040 points

Related Questions In Kubernetes

0 votes
1 answer

How to use gravitational teleport in a container/kubernetes environment?

You can use teleport to augment kubernetes ...READ MORE

answered Jun 28, 2018 in Kubernetes by ajs3033
• 7,280 points
437 views
0 votes
2 answers
0 votes
1 answer
0 votes
1 answer

How to configure load balancer in kubernetes ?

In the deployment file keep the type ...READ MORE

answered Dec 3, 2018 in Kubernetes by Haseeb
72 views
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17 in Others by anonymous
3,522 views
+3 votes
1 answer
0 votes
1 answer

How do I sign-in to kubernetes dashboard?

Since version 1.7 Dashboard uses more secure ...READ MORE

answered Sep 7, 2018 in Kubernetes by DareDev
• 6,810 points
221 views
0 votes
1 answer