Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

OpenShift Quick Tip: Port Forwarding With v3 and the All-In-One-VM

DZone's Guide to

OpenShift Quick Tip: Port Forwarding With v3 and the All-In-One-VM

Learn how to use the OpenShift 'All-In-One-VM' port-forwarding feature for a quick check of a running database.

· Cloud Zone
Free Resource

See how the beta release of Kubernetes on DC/OS 1.10 delivers the most robust platform for building & operating data-intensive, containerized apps. Register now for tech preview.

Just a short tip today, but I was playing around with the all-in-one vm from the OpenShift team and wanted to use the port-forwarding feature for a quick check of a running database. You can use the CLI to forward one or more local ports to a pod. This allows you to listen on a given or random port locally, and have data forwarded to and from given ports in the pod.

But whenever I tried to execute:

oc port-forward mysql-2-zjx6u 3306:3306

It looked like it worked until the very first time I tried to use the tunnel:

I1020 11:38:54.754799 8356 portforward.go:227] Forwarding from 127.0.0.1:3306 -> 3306
I1020 11:38:54.757299 8356 portforward.go:227] Forwarding from [::1]:3306 -> 3306
I1020 11:39:10.824839 8356 portforward.go:253] Handling connection for 3306
E1020 11:39:10.833340 8356 portforward.go:312] An error occurred forwarding 3306 -> 3306: Error forwarding port 3306 to pod mysql-2-zjx6u_myfear, uid : Unable to do port forwarding: socat not found.

Turns out, that the needed socat package isn't installed on the all-in-one-vm. In order to fix that, you have to ssh into the instance:

vagrant ssh

And install socat:

sudo /bin/yum install socat

After that you're able to use the tunnel and forward ports to your OpenShift pod.

Further Information:

New Mesosphere DC/OS 1.10: Production-proven reliability, security & scalability for fast-data, modern apps. Register now for a live demo.

Topics:
cloud ,openshift

Published at DZone with permission of Markus Eisele, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}