Keyboard Shortcuts N Next post
P Previous post
S Save / unsave
R Read aloud
T Toggle theme
/ Focus search
Esc Close panels
🔥
Ready to read...
K8s Networking Kubernetes Kubernetes: From Zero to Production Module 4 - Services and Networking

Ingress - HTTP Routing and TLS in Kubernetes

Reviewed & accurate
AI Summary

What You Will Learn

Intermediate

  • What Ingress is and how it works
  • Routing by domain and path
  • TLS/SSL termination

Ingress is an API object that manages external access to Services via HTTP. It provides name-based virtual hosting, path-based routing, and TLS termination.

ingress.yamlyaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-app-ingress
spec:
  rules:
  - host: api.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: api-service
            port:
              number: 80
  - host: web.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: web-service
            port:
              number: 80
  tls:
  - hosts:
    - api.example.com
    - web.example.com
    secretName: tls-secret
Ingress vs LoadBalancer
LoadBalancer: 1 IP per Service (expensive). Ingress: 1 IP for ALL Services, routes by domain/path (cheap). Use Ingress for web apps, LoadBalancer for TCP/UDP.

Ingress Controllers

Ingress needs a controller to actually route traffic. Popular options:

  • NGINX Ingress Controller (most popular)
  • Traefik (lightweight, modern)
  • HAProxy Ingress
  • Cloud provider controllers (GCE, AWS ALB)
Terminalbash
# Enable Ingress on minikube
minikube addons enable ingress

# Apply your Ingress
kubectl apply -f ingress.yaml

# Check
kubectl get ingress

Practical Exercise

Enable Ingress: minikube addons enable ingress
Create 2 Deployments with different labels
Create 2 Services
Create an Ingress routing to both
Add /etc/hosts entry and test

Key Takeaways

  • Ingress: HTTP routing by domain and path.
  • 1 IP for all Services (vs 1 IP per LoadBalancer).
  • Supports TLS/SSL termination.
  • Needs an Ingress Controller (NGINX, Traefik).
  • Best for: web apps with multiple domains/paths.
Previously: Lesson 20 covered Services.
Today: You learned: HTTP routing, TLS, and domain-based traffic.
Next: Lesson 22 covers DNS.
Test Your Knowledge
How did you find this?

Comments

Join the discussion! Sign in with your Google or Blogger account, or comment as Anonymous - no account needed. For quick questions, also reach me on Telegram @cytestch.

Comments