kind: Ingress
files are known as Ingress Resources/etc/nginx/conf.d
Create an ingress resource from command line:
kubectl create ingress INGRESS-NAME --rule=HOST/PATH=SERVICE_NAME:PORT \
--dry-run=client -o yaml > INGRESS-NAME.yaml
Summing up:
# requirements
# - able to 'kubectl' the cluster
# - helm installed
# add the helm repo
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
# install it on the cluster
helm install nginx-ingress ingress-nginx/ingress-nginx
# check if they're installed
kubectl get svc,deployment nginx-ingress-ingress-nginx-controller
# wait a few minutes and check if an external IP was allocated to the Service
kubectl get service nginx-ingress-ingress-nginx-controller
IMPORTANT: Create the Ingress Resources with the following annotations:
metadata:
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/ssl-redirect: "false"
There's a trick to use [ANY-IP].nip.io
to get [ANY-IP]
.
Example of NginX ingress controller implementation.
nginx.conf
file inside NginX controller pod is a lua template that can talk to the Kubernetes Ingress API and get the latest values for traffic routing in real time./etc/nginx/conf.d
location inside each nginx pod./etc/nginx/conf.d
location./etc/nginx/nginx.conf
file contains all the configurations from /etc/nginx/conf.d
.If you connect to the NginX ingress controller pod using exec
and check the /etc/nginx/nginx.conf
file, you can see all the rules specified in the ingress object applied in the conf file.