Ingress Controller

Ingress Controller

Responsible for routing requests to pods

Ingress resource

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
spec:
  rules:
  - host: inmylab.de
    http:
      paths:
      - pathType: Prefix
        path: "/foo"
        backend:
          service:
            name: foo-service
            port:
              number: 5678

Ingress defines rule to match requests and how to route them

Request matching

Wildcard host names are allowed

Match paths using Exact or Prefix

Target service

Can be backed by multiple pods

Service takes care of load balancing


Demo: Ingress (controller)

Using nginx-based ingress controller

Backend

Two pods foo and bar and…

…accompanying services

Request matching

Match host inmylab.de

Match path prefix /foo and forward to service foo-service

Match path prefix /bar and forward to service bar-service

Demo commands

Deploy ingress controller, services and test connectivity


Infrastructure-as-Code

Manage access automatically - as code

Concepts

external-dns manages DNS records pointing to ingress controller

cert-manager maintains certificates for TLS termination

Flexible ingress controllers offer important features, e.g. traefik among others

Outlook

Ingress resource: focused on HTTP(S), annotations for advanced features

Solved by custom resources, e.g. IngressRoute in traefik


traefik

Supports Ingress resource with annotations and IngressRoute resource

Use with single node Docker for testing

Supports HTTP(S) and TCP

Resource definition Middleware to mutate requests and responses

Dashboard to inspect active configuration

Demo

Deploy traefik as ingress controller using a host port

Deploy demo applications foo and bar

Add IngressRoute resources

Commands