Kubernetes Simulator
beginner · ~8 min
Look inside
web is up and behind its Service — but a ClusterIP is only reachable from inside the cluster, and you'd like to see the site for yourself.
kubectl exec POD -- COMMAND runs a command inside a running container and prints what it printed: the way to look at the files a pod actually has. kubectl port-forward svc/web 8080:80 connects port 8080 on your machine to one of the Service's pods, so curl localhost:8080 reaches it.
Objectives
- Read the page nginx serves, from inside a pod
- Forward local port 8080 to the web Service
- Fetch the page with curl localhost:8080
- Bonus: Find out exactly which nginx is running with nginx -v
Best on a computer with a keyboard. It works on a phone, with shortcuts under the terminal.