Expose Kubernetes cluster resources
There are a lot of valid scenarios the developer would like to the cluster resources exposed so that it could be easily tested and debugged.
If there are no existing services available, it could be exposed using the kubectl command.
You can expose the deployment, pod, or replicate set using the command
kubectl expose replicasets.apps existing-rc –port=9000 –target-port=9000 –type=NodePort –name=testport
otherwise, in case 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
if you are using minikube locally, then you can get the URL as:
minikube service –url the-new-service