Steps to follow to install a ingress controller

1. Create a namespace

Create a namespace and keep all ingress resources there. Use Command in the Control plane server as below - kubectl create namespace my-ingress-space output will look - namespace/my-ingress-space created.

2. Create a configmap object

Configmap is required for NGINX ingress controller Use command - kubectl create configmap my-nginx-configuration -n my-ingress-space output will look - configmap/my-nginx-configuration created.

3. Create a serviceaccount

Use command - kubectl create serviceaccount my-ingress-serviceaccount -n my-ingress-space

4. Create role

5. Create rolebindings

Create rolebindings to bind role with service account.


6. List role and rolebindings for the namespace

kubectl get roles -n my-egress-space
kubectl get rolebindings -n my-egress-space

7. Create ingress controller file and deploy


Use command as - kubectl create -f ingress-controller.yaml
Outout would be - deployment.apps/my-ingress-controller created
You can check the status of the deployment with below. kubectl get pods -n ingress-space kubectl get pods -n ingress-space --watch

8. Create a service to make this ingress available to external users

kubectl expose my-ingress-controller -n my-ingress-space --name ingress --port=80 --target-port=80 --type=NodePort

and it will expose it as service with output as - service/ingress exposed. You can use below command to get the service status- kubectl get svc -n my-ingress-space
It will display - name, type,cluster-ip, ports etc. fields. By default it will choose default NodePort but if you want to change to specific NodePort, you can edit the deployment file and update. Let us edit the NodePort. kubectl edit svc ingress -n my-ingress-space

9. Create ingress resource to make applications available on various paths(/pay, /report) on ingress service

kubectl create ingress ingress-pay-report -n app-space --rule="/pay=pay-service:8080" --rule="/report=report-service:8080" kybectl get ingress -n app-space kubectl describe ingress -n app-space

10. view the logs of the application service pods

kubectl get pods -n app-space


kubectl get pods -n my-ingress-space
kubectl logs pod-name -n app-space
kubectl logs ingress-controll-pod-name -n my-ingress-space

Sometimes you might face issues that service call is coming due to too many redirects. To resolve it, you have update the annotation with sslredirect as false. kubectl edit ingress ingress-pay-report -n app-space

Next