Kubernetes Cluster: Implementing Ingresses
In Kubernetes, an Ingress serves as a load balancer that facilitates external access to services, offers SSL termination, and supports name-based virtual hosting. It operates based on a set of rules (spec) that are applied to all incoming requests.
By default, Traefik is the ingress controller for managing Ingresses in the Kubernetes Cluster, with options like HAProxy and NGINX available in the upcoming 1.15.5 package version. The controller monitors objects, interprets specs/annotations, and converts them into redirection rules.
An Ingress spec comprises a path rule, a backend service, and a port. Here’s an example of what your Ingress may look like:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  labels:
    app: myapp
  name: myapp
  annotations:
    kubernetes.io/ingress.class: traefik
    ingress.kubernetes.io/secure-backends: "true"
    traefik.frontend.rule.type: PathPrefixStrip
spec:
  rules:
  - http:
      paths:
      - path: /myapp
        backend:
          serviceName: myapp
          servicePort: 8080
This example exposes the “myapp” service, which is connected to port 8080, on a path within your Kubernetes environment’s default domain, using the “/myapp” suffix. This means that the service can be accessed via a URL like https://${envName}.${platformDomain.com}/myapp. For further details on configuring ingress rules, including path- and subdomain-based routing, please consult the official documentation.