Kubernetes

How to expose a ReplicaSet as a new service?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

kubectl expose rs --name= --target-port= --type=NodePort

Few notes:

  • the target port depends on which port the app is using in the container
  • type can be different and doesn't has to be specifically "NodePort"