July 2018
Intermediate to advanced
504 pages
11h 34m
English
The following YAML file allows you to define a Service OpenShift object:
$ cat <<EOF > svc-httpd.ymlapiVersion: v1kind: Servicemetadata: labels: name: httpd name: httpdspec: ports: - port: 8080 protocol: TCP targetPort: 8080 selector: name: httpdEOF
Once the file is in place, you can create the service by running the following command:
$ oc create -f svc-httpd.ymlservice "httpd" created$ oc get svcNAME CLUSTER-IP EXTERNAL-IP PORT(S) AGEhttpd 172.30.112.133 <none> 8080/TCP 2s
The service shows the same output as previously described:
$ curl -s http://172.30.112.133:8080 | head -n 4<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ...
Read now
Unlock full access