Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

Chapter 9Name in the course: Traffic and service mesh

Route traffic with proxies and a service mesh

Users never talk to your app directly. A reverse proxy or load balancer takes the request, ends TLS, and sends it to a healthy backend. Inside Kubernetes an ingress controller does this; a service mesh adds rules between services. These 5 tools cover it.

  • 6 Lessons
  • 11 Commands

$ run as a normal user# run as root (or with sudo)

Skills in this chapter

  • Traffic and service mesh — 5

9.1

nginx — web server and reverse proxy

nginx serves files, proxies to apps, ends TLS and caches.

nginx -t
systemctl reload nginx
curl -I https://shop.example.com

Good practice:

  • nginx -t before every reload; reload, do not restart.
  • Timeouts, client_max_body_size and security headers set on purpose.

9.2

HAProxy — fast load balancing

haproxy balances TCP and HTTP traffic with health checks and a stats page.

haproxy -c -f /etc/haproxy/haproxy.cfg
systemctl reload haproxy
echo "show stat" | sudo socat stdio /run/haproxy/admin.sock | cut -d, -f1,2,18 | column -s, -t

9.3

Traefik — the proxy that reads Docker and Kubernetes

traefik finds services by itself (labels, Ingress, IngressRoute) and gets Let's Encrypt certificates.

kubectl get ingressroute -A
docker run -d -l traefik.http.routers.web.rule='Host(`shop.local`)' nginx:1.27

9.4

Istio — a service mesh

istioctl installs and checks Istio: mTLS between pods, retries, and canary traffic splits.

istioctl install --set profile=default -y
istioctl analyze -A
istioctl proxy-status

9.5

Certbot — free TLS certificates

certbot gets and renews Let's Encrypt certificates for servers outside Kubernetes (in Kubernetes: cert-manager).

certbot --nginx -d shop.example.com
certbot renew --dry-run

9.6

Release with less risk

Three ways to put a new version in front of users.

WayHowTool
Rolling updateReplace pods one by oneKubernetes Deployment (default)
Blue/greenRun the new version beside the old, switch all traffic at onceTwo Services, a switch in the Ingress or LB
CanarySend 5–10 % of traffic to the new version, watch, then moreIstio VirtualService weights, Argo Rollouts, nginx canary annotations

Remember

A release strategy only works with good health checks and dashboards that show errors per version.

All commands in this chapter