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,980 points
9,999 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,890 points
0 votes
Hey, You can edit or recreate it with a different name.
answered Dec 6, 2018 by Maverick
• 10,840 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,300 points
2,452 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 4, 2018 in Kubernetes by Haseeb
958 views
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

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

answered Jan 17, 2019 in Others by anonymous
15,422 views
+4 votes
1 answer

Installing Web UI (Dashboard):kubernetes-dashboard on main Ubuntu 16.04.6 LTS (Xenial Xerus) server

Follow these steps: $ kubeadm reset $ kubeadm init ...READ MORE

answered Apr 12, 2019 in Kubernetes by Kalgi
• 52,350 points

reshown Apr 12, 2019 by Kalgi 7,042 views
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,890 points
2,282 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP