In order to deploy Nginx on Bare Metal clusters, There are some considerations that need to be made. In particular because we don't have any load balancer in front of your cluster, we need to make to main changes to the way the ingress controller is deployed
- Make use of
hostNetwork: true
or usehostPort
: This will make ports on the container map to ports on the Host itself - Switch from Deployment to Daemonset: Because we are taking the ports on the host, there can only be on nginx pod on each Node. So using a Daemonset also ensures that adding new nodes contain new deployments of the ingress pod
- Change the dnsPolicy for the pod to use
ClusterFirstWithHostNet
- This will allow pods that are maked ashostNetwork: true
to still resolve in cluster DNS Names (See docs)
For the deployment I have prepared a set of kubectl files from Ingress-Nginx Baremetal Manfiest
First we create the ingress-nginx
namespace
kubectl create ns ingress-nginx
Then we can apply it
kubectl apply -k ingress/nginx/bare-metal