Rajesh Jain
Rajesh Jain

Reputation: 1289

kubectl update service with new label and service names

Is it possible to update an external loadbalancer service in kubernetes with a new spec from an yaml file.

I can do rolling updates of the deployments but how can I update services, primarily not changing the external IP address.

Thanks, Rajesh

Upvotes: 6

Views: 15420

Answers (2)

Suresh Vishnoi
Suresh Vishnoi

Reputation: 18403

If you do not want to edit on the living or already deployed manifest file. you can edit the service manifest file on your computer and use apply action instead of create. For instance,

kubectl apply -f service-manifest.yaml

It will work without changing already existing external IPs

Upvotes: 6

Rajesh Jain
Rajesh Jain

Reputation: 1289

I think I have the answer

env KUBE_EDITOR="nano" kubectl edit svc/my-service

And I can edit the service with the new selector/labels.

I am not sure if there is a better option

Upvotes: 2

Related Questions