Port-forward to a pod (local debugging)

Learning Kubernetes · 3:02

Listen on 93

Lyrics

[Verse 1]
When your pod is running but you can't connect
There's a bridge you need to build, let me direct
Your local machine to the cluster inside
Port-forward is the tunnel where data can ride

[Chorus]
kubectl port-forward pod, that's the way
Eight oh eight oh colon eight oh, every day
Local port to pod port, make the connection
Debugging made easy with this direction

[Verse 2]
First you need the pod name, get it just right
Use kubectl get pods to bring it to light
Copy paste that name, don't make a mistake
One typo will cause the whole tunnel to break

[Chorus]
kubectl port-forward pod, that's the way
Eight oh eight oh colon eight oh, every day
Local port to pod port, make the connection
Debugging made easy with this direction

[Verse 3]
The format is simple, just follow the rule
Pod name after pod slash, it's the perfect tool
Then your local port first, colon in between
Target pod port last, cleanest you've seen

[Bridge]
Eight oh eight oh on your machine
Maps to port eighty where the app is seen
Traffic flows through like a secret door
From localhost straight to the cluster core

[Chorus]
kubectl port-forward pod, that's the way
Eight oh eight oh colon eight oh, every day
Local port to pod port, make the connection
Debugging made easy with this direction

[Verse 4]
Now open your browser, type localhost
Eight oh eight oh takes you coast to coast
From your development box to the pod inside
The Kubernetes bridge is your debugging guide

[Outro]
Port-forward pod name, ports aligned
kubectl makes the connection, peace of mind
Eight oh eight oh colon eight oh, remember the flow
Local debugging, now you know

← Describe a pod (events, conditions, container status) | shorthand: →