OpenShift - Create a port forward rule using the oc port-forward command

Let's say you have a pod named hello-openshift that is listening on port 8080.

~]# oc describe pod hello-openshift | grep -i port
    Port:           8080/TCP

 

The oc port-forward command can be used to create a port forward rule that will be used to forward the request from some other port to port 8080.

~]# oc port-forward pod/hello-openshift 12345:8080
Forwarding from 127.0.0.1:12345 -> 8080
Forwarding from [::1]:12345 -> 8080

 

The oc adm policy who-can command can be used to determine if you have a role that grants permission to create a port forward rule. You may need to Add or Remove a Role Binding from a User Group or Service Account.

~]$ oc adm policy who-can create port-forward

Namespace: my-project
Verb:      create
Resource:  port-forward

Users:  system:admin
        system:serviceaccount:my-project:my-service-account
Groups: my-group
        Openshift_Admin
        system:cluster-admins

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





Please enter 6b08c in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |