expose Kubernetes cluster service

expose the deployment, pod, or replicateset using the expose command

kubectl expose replicasets.apps existing-rc –port=9000 –target-port=9000 –type=NodePort –name=testport

otherwise, if you already have a service running, you can upgrade it

`kubectl patch svc existing-service -p ‘{“spec”: {“type”: “NodePort”}}’`


Note, if you already have cluster IP, you can also use LoadBalancer.

after that, you should have the service with the necessary port information

Screenshot 2020-03-18 at 12.11.36 PM

if you are using minikube locally, you can get the URL as:

minikube service –url the-new-service

Screenshot 2020-03-18 at 12.13.25 PM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s