Kubernetes service only available inside the cluster? Do you need to connect and test something? Port-forward from your client to the cluster! Only using kubectl.
The syntax is as follows:
~$ kubectl port-forward svc/[K8S_SERVICE] LOCAL_PORT:REMOTE_PORT
So let’s say you want to connect to a MySQL Service only available in the cluster network. And the service is called “mysql-service”:
~$ kubectl port-forward svc/mysql-service 31337:3306 Forwarding from 127.0.0.1:31337 -> 3306 Forwarding from [::1]:31337 -> 3306
The MySQL Service is now available under localhost:31337.
See you on the inside 👾