Creating Ingresses
Kubernetes Cluster: Creating Ingresses
Ingress Overview
An Ingress works as a Kubernetes routing layer in front of Services. Incoming requests are compared with the rules defined in the Ingress specification and then forwarded to the appropriate backend Service and port.
- Route requests according to URL path.
- Route requests according to hostname or subdomain.
- Terminate SSL/TLS at the ingress-controller layer.
- Apply controller-specific features such as authentication and advanced routing.
Ingress Controllers
Ingress resources require an ingress controller. The controller watches Kubernetes Ingress objects, reads their specifications and annotations, and translates them into active routing rules.
Ingress Specification
An Ingress rule combines three main elements:
Path-Based Routing Example
The following example exposes a Service named myapp through the /myapp path and forwards requests to Service port 8080.
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
extensions/v1beta1 Ingress API. For newer Kubernetes versions, use the currently supported Ingress API syntax for your cluster.
The controller-specific annotations in this example instruct Traefik to manage the Ingress and use path-prefix stripping behavior for the configured route.
How the Example Is Accessed
With the example above, the myapp Service becomes available under the Kubernetes environment’s default domain with the /myapp path:
https://${envName}.${platformDomain.com}/myapp
- The incoming request reaches the Kubernetes ingress controller.
- The controller matches the
/myapppath. - The request is routed to the
myappService. - The Service forwards the request to its backend application on port
8080.
