July 2018
Intermediate to advanced
504 pages
11h 34m
English
You can create a pod using oc expose in the following way:
$ oc get podNAME READY STATUS RESTARTS AGEhttpd 1/1 Running 0 13m$ oc expose pod httpd --name httpdservice "httpd" exposed$ oc get svcNAME CLUSTER-IP EXTERNAL-IP PORT(S) AGEhttpd 172.30.128.131 <none> 8080/TCP 3s
The preceding command creates a service by exposing the pod, using name=httpd as a selector. You may define a custom service name via the --name option.
The same httpd application will be available from the service IP address, which is 172.30.128.131 in our case, but your output from the previous command most likely will be different:
$ curl -s http://172.30.128.131:8080 | head -n4<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> ...