I'm new to kubernetes and openshift (came from docker swarm world) and I'm having trouble with some of kubernetes and openshift documentation especially related to route and services. I was looking for how to expose a replica set of containers externally and I've found kubernetes documentation uses a service to expose the pod while openshift uses routes. can anyone explain to me the differences?
So now in OpenShift we have a Route objects which do almost the same job as Ingress in Kubernetes. The main difference is that routes are implemented by good, old HAproxy that can be replaced by commercial solution based on F5 BIG-IP.
Each route consists of a route name (limited to 63 characters), service selector, and (optionally) security configuration. An OpenShift administrator can deploy routers in an OpenShift cluster, which enable routes created by developers to be used by external clients.
So to get HTTP (S) traffic from the outside to your Service, OpenShift uses Routes ( Ingress in other Kubernetes distributions): So to expose your application to the outside world, you typically create an internal Service using oc create service and then create a Route using oc expose:
The Router objects in OpenShift and Ingress in K8s almost perform identical jobs. The prominent contrast is that routes are implemented by good, old HAproxy that can be replaced by a commercial solution based on F5 BIG-IP.
There are only minor differences in tools being used. OpenShift is a Kubernetes distribution, this means it is a collection of opinionated pre-selected components. So for Ingress, OpenShift uses HAProxy to get (HTTP) traffic into the cluster. Other Kubernetes distributions maybe use the NGINX Ingress Controller or something similar.
So Services
are used to loadbalance traffic inside the cluster. So when you create a ReplicaSet
, you'll have multiple Pods running. To "talk" to these Pods, you typically create a Service
. That Service
will distribute the traffic evenly between your Pods.
So to get HTTP(S) traffic from the outside to your Service
, OpenShift uses Routes
(Ingress
in other Kubernetes distributions):
+-----+
+-->+ Pod |
+-------+ +---------+ | +-----+
Traffic--->+ Route +------>+ Service +--+-->+ Pod |
+-------+ +---------+ | +-----+
+-->+ Pod |
+-----+
So to expose your application to the outside world, you typically create an internal Service
using oc create service
and then create a Route
using oc expose
:
# Create a new ClusterIP service named myservice
oc create service clusterip myservice --tcp=8080:8080
oc expose service myservice
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With