IngressController
IngressController
Nginx IngressController
Prerequisites
-
Kubernetes Cluster Access
-
Install Nginx IngressController
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.3.0/deploy/static/provider/cloud/deploy.yaml
- Install using Helm
helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace
- Verify IngressController
kubectl get pods --namespace ingress-nginx
- Check the NGINX Ingress controller has been assigned a public Ip address
kubectl get service ingress-nginx-controller --namespace=ingress-nginx
Browsing to this IP address will show you the NGINX 404 page. This is because we have not set up any routing rules for our services yet
- Create two deployment
kubectl create deployment myapp01 --image=nginx
kubectl create deployment myapp02 --image=httpd
- Create service of type ClusterIp for above two deployment
kubectl expose deployment/myapp01 --port=80
kubectl expose deployment/myapp02 --port=80
- Map the IngressController Svc ip in DNS
kubectl get svc -n
- Check How many ingressClass are available
kubectl get ingressclass
- Create ingress rule
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: name-virtual-host-ingress
spec:
ingressClassName: nginx
rules:
- host: <Change this> myapp01.serverwebpage.com
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: myapp01
port:
number: 80
- host: <Change this > myapp02.serverwebpage.com
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: myapp02
port:
number: 80
- Now try to access the application in browser
myapp01.serverwebpage.com
myapp02.serverwebpage.com
if page open your You have been able to set up IngressController.
- Now Secure your app using Let us Encrypt and Cert Manager