How do I un-expose (undo expose) service?

Assuming you have a deployment called hello-world, and do a kubectl expose as follows:

kubectl expose deployment hello-world --type=ClusterIP --name=my-service

this will create a service called my-service, which makes your deployment accessible for debugging, as you described.

To display information about the Service:

kubectl get services my-service

To delete this service when you are done debugging:

kubectl delete service my-service

Now your deployment is un-exposed.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)