Ingress NGINX (not to be confused with NGINX Ingress) is a Kubernetes ingress controller that uses NGINX as a reverse proxy and load balancer.
Install
The simplest way to install is via the official Helm chart:
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm upgrade ingress-nginx ingress-nginx/ingress-nginx \
--install \
--namespace ingress-nginx \
--create-namespace \
--wait
Once installed, here is a complete example manifest that deploys a service and exposes it via an ingress with TLS:
apiVersion: apps/v1
kind: Deployment
metadata:
name: example-deployment
namespace: example
spec:
selector:
matchLabels:
app: example
template:
metadata:
labels:
app: example
spec:
containers:
- name: example
image: nginx
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: example-service
namespace: example
spec:
selector:
app: example
ports:
- port: 80
targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: example-ingress
namespace: example
spec:
ingressClassName: nginx
rules:
- host: example.mydomain.com
http:
paths:
- path: /
backend:
service:
name: example-service
port:
number: 80
pathType: Prefix
tls:
- secretName: certificate-tls
hosts:
- example.mydomain.com
Confirm the ingress has been created and assigned an external IP:
$ kubectl get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
example-ingress nginx example.mydomain.com 11.22.33.44 80, 443 64d
Now that cert-manager, ExternalDNS, and Ingress NGINX are all deployed, the base environment is ready. Any application you deploy on the cluster can now benefit from:
- Automatic SSL certificates via cert-manager and Let’s Encrypt
- Automatic DNS registration via ExternalDNS and Google Cloud DNS
- Ingress routing via Ingress NGINX
No more manual certificate renewals or DNS updates — the stack handles it all for you.
References :
Keywords : Kubernetes, Google Kubernetes Engine, GKE, Ingress NGINX