# Installation of Ingress nginx

Refer: [https://github.com/kubernetes/ingress-nginx](https://github.com/kubernetes/ingress-nginx)

## Install using baremetal

Refer: [https://kubernetes.github.io/ingress-nginx/deploy/#bare-metal](https://kubernetes.github.io/ingress-nginx/deploy/#bare-metal)

Download script to specific folder

```shell
cd <folder-path>
wget https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.46.0/deploy/static/provider/baremetal/deploy.yaml
```

Rename download .yaml file

```shell
mv ./deploy.yaml ingress-nginx-controller.yaml
```

in order to use ingress and assign an external ip address we ned to use Load Balancer instead of NodePort of ingress nginx controller. Update ingress-nginx-controller.yaml with following lines

```YAML
spec:
  type: LoadBalancer
  externalIPs:
    - <valid-external-ip>

```

[![image-1621791956718.png](https://book-stack.rapidoreach.com/uploads/images/gallery/2021-05/scaled-1680-/3Q5vNZGBxA5vECYk-image-1621791956718.png)](https://book-stack.rapidoreach.com/uploads/images/gallery/2021-05/3Q5vNZGBxA5vECYk-image-1621791956718.png)

Install ingress controller using following command

```YAML
kubectl apply -f ingress-nginx-controller.yaml
```

Above command will create following pods and services

[![image-1621792142431.png](https://book-stack.rapidoreach.com/uploads/images/gallery/2021-05/scaled-1680-/V9IZcCrWvk3PWa2I-image-1621792142431.png)](https://book-stack.rapidoreach.com/uploads/images/gallery/2021-05/V9IZcCrWvk3PWa2I-image-1621792142431.png)

> ingress nginx controller is now installed. We can now create ingress object to correctly route traffix to NodePort or ClusterIP services