🚪
Kubernetes

Ingress (NGINX)

Route external HTTP traffic to cluster Services via Ingress controller

📋Configuration Files

Ingress.yml

yaml
1apiVersion: networking.k8s.io/v1
2kind: Ingress
3metadata:
4 name: minimal-ingress
5 annotations:
6 nginx.ingress.kubernetes.io/rewrite-target: /
7spec:
8 rules:
9 - http:
10 paths:
11 - path: /testpath
12 pathType: Prefix
13 backend:
14 service:
15 name: test
16 port:
17 number: 80

Ingress: minimal vs production

What to add before production merge

AspectMinimalProduction
TLSHTTP onlycert-manager ClusterIssuer + tls: block
Annotationsbasic routingrate limits, body size, timeout, WAF if needed
Backendsingle servicehealth-checked service + correct port name
DNSmanual /etc/hostsRoute53 or Cloudflare pointing to LB
📄

Step 01

Deploy Ingress

(01)Install NGINX Ingress Controller

Linux
1kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.11.1/deploy/static/provider/cloud/deploy.yaml
2kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=120s

(02)Apply Ingress resource

Linux
1kubectl apply -f Ingress.yml
2kubectl get ingress
3kubectl describe ingress minimal-ingress