Open danilutkin opened 3 years ago
Hi @danilutkin thanks for reporting!
Be sure to check out the docs while you wait for a human to take a look at this :slightly_smiling_face:
Cheers!
Hi @danilutkin
Originally we made an assumption that the ports of Ingress Controller daemonset pods would be exposed using port-mapping rather then a service, so that's why it is the default option for the daemonset. However, we didn't make it configurable :(
I think we can make the hostPorts configurable with parameters like below, where an empty value will disable port-mapping:
controller.httpPort.hostPort
controller.httpsPort.hostPort
I wonder if you have a workaround for now? Would running a deployment with affinity (controller.affinity
) rules work so that you have one pod per node? https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity
Hi @pleshakov
I thought that I would choose a daemonset for the first controller and just a replicated deployment for the second controller. Or I would use deployment with replicas for both controllers. But it doesn't seem like a clear solution.
In my "NodePort" world i think just need to patch daemonset installation from helm with needed configs. For example if hostPort not configurable for now from values.yaml, I can using a json patch with positional arrays.
kubectl -n infra patch ds second-controller-nginx-ingress --type json -p='[{"op": "remove", "path": "/spec/template/spec/containers/0/ports/0/hostPort"}]'
kubectl -n infra patch ds second-controller-nginx-ingress --type json -p='[{"op": "remove", "path": "/spec/template/spec/containers/0/ports/1/hostPort"}]'
Any other my ideas require something more than one line patching, for example with creating some labels and selectors with logic.
Is it ok, if i make a PR with configurable hostPort settings like you say above?
@danilutkin
not sure if that would work for you, but another approach is to patch the helm chart sources and install the IC from the patched version of the Helm chart instead of our helm repo.
Is it ok, if i make a PR with configurable hostPort settings like you say above?
yep, we'd be happy to review! However, because of the vacations in our team, please expect some delays.
Will something like this works? https://github.com/nginxinc/kubernetes-ingress/compare/development...SuperCipher:feature/helm-daemonset-hostport-configurable
Very near. What you think about changing:
.Values.hostPort.httpPort - > .Values.controller.hostPort.httpPort .Values.hostPort.httpsPort - > .Values.controller.hostPort.httpsPort
@danilutkin ok fixed https://github.com/nginxinc/kubernetes-ingress/compare/development...SuperCipher:feature/helm-daemonset-hostport-configurable
Why is PR template said I should target master branch? Why not the development branch?🤔
@SuperCipher Hi and Thank you for your changes) Are you tested this changes? The main purpose of this changes from my opinion is to disable hostPort parameter for daemonset kind IC setup. For ability to setup multiple daemonset IC. If it tested i don't see the reason not to merge your branch to master.
Just found this thread after running into the same issue. I would really like to deploy the ingress across multiple nodes without conflict
Running Multiple NGINX Ingress Controllers as Daemonset not working because of hostPort setting in Daemonset related resources.
To Reproduce Steps to reproduce the behavior:
Expected behavior for me Second-ingress-controller up and running.
My environment
Additional context The behavior we have it's because hostPort setting. https://kubernetes.io/docs/concepts/configuration/overview/
In daemon-set configs we have hostPort setting: https://github.com/nginxinc/kubernetes-ingress/blob/master/deployments/daemon-set/nginx-ingress.yaml https://github.com/nginxinc/kubernetes-ingress/blob/master/deployments/daemon-set/nginx-plus-ingress.yaml https://github.com/nginxinc/kubernetes-ingress/blob/master/deployments/helm-chart/templates/controller-daemonset.yaml
In deployment configs we don't have hostPort setting: https://github.com/nginxinc/kubernetes-ingress/blob/master/deployments/deployment/nginx-ingress.yaml https://github.com/nginxinc/kubernetes-ingress/blob/master/deployments/deployment/nginx-plus-ingress.yaml https://github.com/nginxinc/kubernetes-ingress/blob/master/deployments/helm-chart/templates/controller-deployment.yaml
Why we need to use
hostPort
in daemonset configurations? Can we just delete this setting like in deployment configurations? Maybe we should make template with ability to removehostPort
configuration by specifying some conditions?Aha! Link: https://nginx.aha.io/features/IC-235