Expose Kubernetes services with ngrok

Test app (nginx)

kubectl apply -f https://raw.githubusercontent.com/abhirockzz/ngrok-kubernetes/master/nginx-deployment.yaml
kubectl apply -f https://raw.githubusercontent.com/abhirockzz/ngrok-kubernetes/master/nginx-service.yaml

Enter ngrok..

kubectl apply -f https://raw.githubusercontent.com/abhirockzz/ngrok-kubernetes/master/ngrok-deployment.yaml
  • gets the Pod for the ngrok Deployment
  • uses the HTTP endpoint inside of the ngrok Pod to get the details (using kubectl exec inside the running Pod)
kubectl exec $(kubectl get pods -l=app=ngrok -o=jsonpath='{.items[0].metadata.name}') -- curl http://localhost:4040/api/tunnels
nginx in k8s exposed via ngrok

Optionally….

kubectl apply -f https://raw.githubusercontent.com/abhirockzz/ngrok-kubernetes/master/ngrok-service.yaml
kubectl get svc ngrok-service -o=jsonpath='{.spec.ports[?(@.port==4040)].nodePort}'//e.g. 30552
$ minikube ip192.168.99.100
http://<minikube-ip>:<service-node-port>/statuse.g. http://192.168.99.100:30552/status
ngrok dashboard

Principal Developer Advocate at AWS | I ❤️ Databases, Go, Kubernetes

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abhishek Gupta

Abhishek Gupta

Principal Developer Advocate at AWS | I ❤️ Databases, Go, Kubernetes

More from Medium

What is Kubernetes?

The Kubernetes documentary!

Debugging Kubernetes Ingress Objects

Deploy a Microservice into Istio service mesh

This image has an empty alt attribute; its file name is image.png