Openshift equivalent of Kubectl expose pod

4/13/2020

I am fairly new to openshift.

Is there a REST API available to expose a pod ? Basically I am looking to do something like:

kubectl expose pod pod-name
-- dj308
kubernetes
openshift
openshift-client-tools

1 Answer

4/14/2020

oc expose

Just like in kubectl - expose

As per OpenShift CLI (oc) man

expose

Expose a Service externally as a Route.

Example: Expose a Service

$ oc expose service/parksmap-katacoda

Example: Expose a Service and specify the host name

$ oc expose service/parksmap-katacoda --hostname=www.my-host.com

virtctl expose

Also, you can use virtctl expose

The virtctl client is a command-line utility for managing container-native virtualization resources. The following table contains the virtctl commands used throughout the container-native virtualization documentation.

virtctl expose <vm>

Create a service that forwards a designated port of a virtual machine or virtual machine instance and expose the service on the specified port of the node.

-- Yasen
Source: StackOverflow