Skip to content

Latest commit

 

History

History
72 lines (49 loc) · 2.11 KB

nginx.md

File metadata and controls

72 lines (49 loc) · 2.11 KB

Setup Nginx Kubernetes Ingress Controller

Nginx Ingress controller

Express Install

To quickly install the ingress controller simply run the following

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.35.0/deploy/static/provider/cloud/deploy.yaml

details here https://kubernetes.github.io/ingress-nginx/deploy/

Detailed Install

For more Details on Deploying the Nginx Controller you can use the docs located here

https://docs.nginx.com/nginx-ingress-controller/installation/installation-with-manifests/

Clone the Nginx Deployment for a Specific Version

git clone https://github.com/nginxinc/kubernetes-ingress/
cd kubernetes-ingress/deployments
git checkout v1.7.2

Authorization

Create the namespace and deploy RBAC authorization

# Create a namespace and a service account for Ingress controller
kubectl apply -f common/ns-and-sa.yaml
# Create a cluster role and cluster role binding for the service account:
kubectl apply -f rbac/rbac.yaml

Create Configuration

# Create a secret with a TLS certificate and a key for the default server in NGINX
kubectl apply -f common/default-server-secret.yaml
kubectl apply -f common/nginx-config.yaml

Deploy Ingress

Finally we deploy the ingress controller

# Deploy the Ingress Controller
kubectl apply -f deployment/nginx-ingress.yaml

But the ingress controller isn't connected to the outside world. To accomplish that we simply create the loadbalancer service

NOTE: This service type does not work for Amazon EKS. Please check the documentation for details about deploying this to EKS

For Load Balancer, we can simply run the following

# Use the following for Typical cloud based clusters
kubectl apply -f service/loadbalancer.yaml

After it's been deployed, you can simply run

kubectl get svc nginx-ingress --namespace=nginx-ingress

to get the IP Address of the loadbalancer. You need to make all domains you want served by the ingress controller to this IP Address