OpenShift - Create load balance service using the oc create service command

by
Jeremy Canfield |
Updated: August 09 2022
| OpenShift articles
If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.
- Using an OpenShift route (this is the most common)
- Using an ingress route
- Using a load balancer service
- Assign an external IP address to a service
A service can be used to load balance requests across pods.
The oc create service command can be used to create these type of services.
- clusterip
- externalname
- loadbalancer
- nodeport
In this example, a load balancer service named lb-service is created.
~]$ oc create service loadbalancer lb-service --tcp=8080
service/lb-service created
The oc get services command should show the service has been created. In this example that the service is listening on port 8080.
~]$ oc get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
lb-service LoadBalancer 10.14.52.14 <pending> 8080:30632/TCP 51s
Did you find this article helpful?
If so, consider buying me a coffee over at