Ingress
Overview#
An Ingress tells the cluster which requests go to which application. We run Traefik as the ingress controller, behind the cluster's load balancer:
flowchart TD
DNS[shop.example.com] --DNS--> LB[Load Balancer]
LB --> Traefik
Traefik --Host: shop.example.com--- Frontend[Frontend Service]
Traefik --Host: api.example.com--- API[API Service]
Frontend --> Pod1[Frontend Pod]
Frontend --> Pod2[Frontend Pod]
- The domain resolves to the cluster's load balancer.
- Traefik receives the request and looks for an
Ingresswhose host matches. - The request goes to the
Servicenamed in thatIngress, and from there to one of its pods.
Exposing an application with TLS#
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-app
namespace: my-app
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod-http
spec:
rules:
- host: my-app.workload.<project>.<org>.kloudease.tech
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: my-app
port:
name: http
tls:
- hosts:
- my-app.workload.<project>.<org>.kloudease.tech
secretName: my-app-tls
- The
Servicemy-appmust exist in the same namespace; see the Kubernetes documentation. - Traefik is the default ingress class, so leave
ingressClassNameout. Its name differs between clusters. - The
cert-manager.io/cluster-issuer: letsencrypt-prod-httpannotation gets a certificate from Let's Encrypt and renews it automatically. The certificate is stored in the Secret named undertls.secretName. It works for your kloudease domain and for your own domains, as long as the name resolves to the cluster. If your cluster only accepts traffic from an IP allowlist, Let's Encrypt can't reach it; contact kloudease Support for a certificate. - The Traefik annotation
traefik.ingress.kubernetes.io/router.priorityis not allowed on your Ingresses.