Skip to content

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]
  1. The domain resolves to the cluster's load balancer.
  2. Traefik receives the request and looks for an Ingress whose host matches.
  3. The request goes to the Service named in that Ingress, 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 Service my-app must exist in the same namespace; see the Kubernetes documentation.
  • Traefik is the default ingress class, so leave ingressClassName out. Its name differs between clusters.
  • The cert-manager.io/cluster-issuer: letsencrypt-prod-http annotation gets a certificate from Let's Encrypt and renews it automatically. The certificate is stored in the Secret named under tls.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.priority is not allowed on your Ingresses.