Kubernetes 101 : Changing a service type



If we realize that our service, a ClusterIP doesn't suit our needs anymore, we could change its type to a  nodePort service for example.

In our example, we have a service that exposes the "nginx" pods on the "port:80" as below:


We could create our service, using the below command:


We could alter our service, using the below command:


We change the service type to nodePort and the container port to nodePort that has a value between ( 30000 and 32767 ).

The "kubectl edit" command opens a Yaml file in the text editor specified in the KUBE_EDITOR environment variable.

We could check our changes by looking at the Yaml file of our service, using the below command:


Comments

Leave as a comment:

Archive