Skip to main content

Ingress

An ingress controller consists of:

  • Ingress Deployment # The Ingress Controller -k edit deployment …
  • Ingress Resource # Ingress Config -k edit ingress
  • IngressClass # Metadata that links Ingress with Controller
  • Pods—Nginx deployment (if it is Nginx)
  • ConfigMap
  • Service
  • ServiceAccount

Multiple Ingresses (resources/configs)

An Ingress deployment can watch multiple Ingress resources for the path matchings.

$ k get ingress # Ingress resource object (rules)
$ k get ingressclass # The Ingress controller type

kubectl create ingress my-ingress \
--class=nginx \
--rule="wear.my-online-store.com/wear*=wear-service:80"

# Ingress is a deployment itself with it's own pods running in a namespace
$ k get deployments.apps -A | grep ingress
ingress-nginx ingress-nginx-controller 1/1 1 1 16m

-> Ingress Deployment has the default backend service defined.
ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-wear-watch
annotations:
nginx.ingress.kubernetes.io/rewrite-target: / #rewrites to / from /wear
nginx.ingress.kubernetes.io/ssl-redirect: false #rewrites to / from /wear
spec:
rules:
- host: incoming-host.com # If you omit, it is *
http:
paths:
- path: /wear
backend:
service:
name: wear-service
port:
number: 80
- path: ...

Ingress defines path forwardings to services, should be in the services namespace Service is the hostname with round-robin to pods. Service can use kube expose to be created with selectors An external service can be in another namespace Ingress Controller is the