Install Nginx Ingress

Kubernetes Ingress is another method of exposing your applications to services outside the cluster. It routes the traffic from outside the cluster into the cluster and to your application.

We’ll be using Nginx for our ingress controller.

Install Nginx Ingress

This is pretty simple. Since we’re on a “bare-metal” cluster, we’ll be following the step’s laid out in this Document

$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.1/deploy/static/provider/baremetal/deploy.yaml

namespace/ingress-nginx created
serviceaccount/ingress-nginx created
configmap/ingress-nginx-controller created
clusterrole.rbac.authorization.k8s.io/ingress-nginx created
clusterrolebinding.rbac.authorization.k8s.io/ingress-nginx created
role.rbac.authorization.k8s.io/ingress-nginx created
rolebinding.rbac.authorization.k8s.io/ingress-nginx created
service/ingress-nginx-controller-admission created
service/ingress-nginx-controller created
deployment.apps/ingress-nginx-controller created
ingressclass.networking.k8s.io/nginx created
validatingwebhookconfiguration.admissionregistration.k8s.io/ingress-nginx-admission created
serviceaccount/ingress-nginx-admission created
clusterrole.rbac.authorization.k8s.io/ingress-nginx-admission created
clusterrolebinding.rbac.authorization.k8s.io/ingress-nginx-admission created
role.rbac.authorization.k8s.io/ingress-nginx-admission created
rolebinding.rbac.authorization.k8s.io/ingress-nginx-admission created
job.batch/ingress-nginx-admission-create created
job.batch/ingress-nginx-admission-patch created

Confirmation

We can confirm Nginx Ingress is installed correctly by running the following two commands:

  1. Here we can see the ingress-nginx namespace was created:

     $ kubectl get ns
    
     NAME              STATUS   AGE
     default           Active   30h
     kube-system       Active   30h
     kube-public       Active   30h
     kube-node-lease   Active   30h
     metallb-system    Active   27h
     cert-manager      Active   44m
     ingress-nginx     Active   10m
    
  2. In the following, we can see the ingress controller is running and services have been created successfully:

     $ kubectl get all -n ingress-nginx
    
     NAME                                            READY   STATUS      RESTARTS   AGE
     pod/ingress-nginx-admission-create--1-mfkhn     0/1     Completed   0          10m
     pod/ingress-nginx-admission-patch--1-fbtzx      0/1     Completed   0          10m
     pod/ingress-nginx-controller-778574f59b-n25bw   1/1     Running     0          10m
    
     NAME                                         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
     service/ingress-nginx-controller-admission   ClusterIP   10.43.41.89     <none>        443/TCP                      10m
     service/ingress-nginx-controller             NodePort    10.43.118.127   <none>        80:31469/TCP,443:32178/TCP   10m
    
     NAME                                       READY   UP-TO-DATE   AVAILABLE   AGE
     deployment.apps/ingress-nginx-controller   1/1     1            1           10m
    
     NAME                                                  DESIRED   CURRENT   READY   AGE
     replicaset.apps/ingress-nginx-controller-778574f59b   1         1         1       10m
    
     NAME                                       COMPLETIONS   DURATION   AGE
     job.batch/ingress-nginx-admission-create   1/1           3s         10m
     job.batch/ingress-nginx-admission-patch    1/1           3s         10m