Recall & Review
beginner
What does the
kubectl port-forward command do?It forwards a port from a local machine to a port on a Kubernetes pod, allowing local access to the pod's service without exposing it externally.
Click to reveal answer
beginner
How do you forward local port 8080 to port 80 on a pod named
my-pod?Use the command:
kubectl port-forward pod/my-pod 8080:80Click to reveal answer
beginner
Can
kubectl port-forward be used to access services inside a Kubernetes cluster without exposing them externally?Yes, it allows local access to pods or services without changing cluster network settings or exposing services outside the cluster.
Click to reveal answer
intermediate
What is the syntax to forward a local port to a service instead of a pod?
Use:
kubectl port-forward service/ :Click to reveal answer
intermediate
Why might you use
kubectl port-forward instead of exposing a service with a LoadBalancer?Because it is quick, requires no cluster changes, and is safer for temporary access without exposing the service to the internet.
Click to reveal answer
What is the correct command to forward local port 3000 to port 80 on a pod named
web-pod?✗ Incorrect
The correct syntax is
kubectl port-forward pod/web-pod 3000:80 to forward local port 3000 to pod port 80.Which resource types can
kubectl port-forward forward ports to?✗ Incorrect
kubectl port-forward supports forwarding to both pods and services.What happens if you close the terminal running
kubectl port-forward?✗ Incorrect
Port forwarding runs in the terminal session; closing it stops the forwarding.
Why is
kubectl port-forward considered secure for local testing?✗ Incorrect
Port forwarding only opens ports on the local machine, not exposing them externally.
Which of these is NOT a valid use of
kubectl port-forward?✗ Incorrect
Port forwarding is temporary and local; it does not expose services permanently to the internet.
Explain how
kubectl port-forward helps you access a Kubernetes pod locally without exposing it externally.Think about how you connect your computer to a service inside the cluster safely.
You got /4 concepts.
Describe the steps and command syntax to forward local port 5000 to port 5000 on a service named
my-service.Remember the resource type and port mapping format.
You got /4 concepts.