kubectl update service with new label and service names

12/6/2017

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

-- Rajesh Jain
kubectl
kubernetes

2 Answers

12/6/2017

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

-- Rajesh Jain
Source: StackOverflow

12/7/2017

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

-- Suresh Vishnoi
Source: StackOverflow