Which command forwards traffic from your local machine to a Pod port in OpenShift?

Prepare for the Red Hat Openshift Developer EX288 Exam. Study with comprehensive quizzes and flashcards. Each question includes hints and explanations to enhance your understanding. Ace your exam with confidence!

Multiple Choice

Which command forwards traffic from your local machine to a Pod port in OpenShift?

Explanation:
Port forwarding from your workstation to a pod is done with the port-forward command. It creates a tunnel that maps a local port to a port on the targeted pod, allowing you to access the pod’s service locally without exposing it externally. The correct syntax is oc port-forward <pod-name> <local-port>:<pod-port>. For example, oc port-forward my-pod 8080:80 maps localhost:8080 to port 80 on the pod, useful for debugging or testing a single pod. This works only with a pod, not a service, and there isn’t a forward or tunnel command in this context. Port-forward remains the direct way to reach the pod’s port from your machine, and you can add more port mappings if you need to.

Port forwarding from your workstation to a pod is done with the port-forward command. It creates a tunnel that maps a local port to a port on the targeted pod, allowing you to access the pod’s service locally without exposing it externally. The correct syntax is oc port-forward :. For example, oc port-forward my-pod 8080:80 maps localhost:8080 to port 80 on the pod, useful for debugging or testing a single pod.

This works only with a pod, not a service, and there isn’t a forward or tunnel command in this context. Port-forward remains the direct way to reach the pod’s port from your machine, and you can add more port mappings if you need to.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy