Use services to decouple clients from the lifecycle of pods. Configure a route when you need an application reachable at a DNS name (for example
www.somewebapp.com) or when you need TLS termination and traffic control.Why use Services?
- Provide a stable ClusterIP and DNS name for intra-cluster communication.
- Act as a simple load balancer to forward traffic to matching pods.
- Let you change or redeploy pods without updating client configuration.
- Enable exposing an application to external users via a route.
- Frontend → Backend via a service
- Backend → Data-processing component via a service
- Exposing an application to end users via a service + route
- Accessing external databases via services
- A stable cluster-internal IP and DNS (ClusterIP)
- Selectors that choose which pods receive traffic (e.g.
deploymentconfig=simple-webapp-docker) - One or more service ports and target ports on the pods

Example: Service selector and port mapping
Here is a minimal Service YAML that maps service port 8080 to the pod target port 8080 and selects pods withdeploymentconfig=simple-webapp-docker:
- List services:
oc get svc - Describe a service:
oc describe svc simple-webapp
Service types (when you need them)
Routes — expose services externally
A route provides a hostname (for examplewww.somewebapp.com) and proxies external requests to a service. Routes are similar to having an external load balancer or proxy (e.g., HAProxy) in front of the service; OpenShift’s router implements this.
Routes support:
- Hostname-based exposure (DNS → router → service)
- Load balancing between pods behind the service
- TLS termination (edge, passthrough, re-encrypt)
- Behavior for insecure HTTP traffic (allow, redirect, or disable)
- Traffic splitting across multiple services for staged rollouts

Example: route basic spec
A simple Route to expose thesimple-webapp service at www.somewebapp.com:
oc get routeTo describe a route:
oc describe route simple-webapp-route
Route security and TLS termination
Routes let you terminate TLS at the router (edge), pass TLS through (passthrough), or re-encrypt (router decrypts and re-encrypts to the backend). You can also set how to handle insecure traffic via theinsecureEdgeTerminationPolicy (Allow, Redirect, None).
Common TLS options:
- edge — TLS terminates at the router (provide cert/key on the route)
- passthrough — TLS passes directly to the pod; backend must handle TLS
- re-encrypt — TLS terminates on the router, then is re-encrypted to the backend

When terminating TLS at the router, ensure certificates are valid and private keys are protected. If you use
passthrough, backend pods must be configured to serve TLS and handle certificates securely.Traffic splitting (A/B testing, canary releases)
Routes support splitting traffic across multiple services usingto and alternateBackends with weight values. This is useful for gradual rollouts and A/B testing.

simple-webapp and simple-webapp-new: