codegurukool.com · Free coding tutorials & online compiler

Home › Kubernetes Tutorial › Ingress

Ingress

Route web traffic by host and path.

An Ingress sends outside HTTP and HTTPS traffic to Services based on host name and URL path, so one load balancer can serve many apps. It needs an ingress controller such as NGINX (on minikube: minikube addons enable ingress).

Example code

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: web-ingress
spec:
  rules:
    - host: web.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: web
                port:
                  number: 80

Run this code in the online editor

← Volumes and persistent storageHealth probes and resource limits →