Provide nodeSelector to nginx ingress using helm

3/3/2020

I spent some time looking into how to pass the parameters to helm in order to configure the nodeSelector properly.

Different tries led to different errors like:

Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: ValidationError(Deployment.spec.template.spec.nodeSelector.kubernetes): invalid type for io.k8s.api.core.v1.PodSpec.nodeSelector: got "map", expected "string"
coalesce.go:196: warning: cannot overwrite table with non table for nodeSelector (map[])
-- aitorhh
kubernetes
nginx-ingress

1 Answer

3/3/2020

Reference: https://docs.microsoft.com/en-us/azure/aks/ingress-static-ip

In the link above, we can see how it should be used:

helm install nginx-ingress stable/nginx-ingress \
    --namespace $NAMESPACE \
    --set controller.replicaCount=1 \
    --set controller.nodeSelector."kubernetes\.io/hostname"=$LOADBALANCER_NODE \
    --set controller.service.loadBalancerIP="$LOADBALANCER_IP" \
    --set controller.extraArgs.default-ssl-certificate="$NAMESPACE/$LOADBALANCER_NODE-ssl"

In general it is a good source to look into helm help: https://helm.sh/docs/intro/using_helm/#the-format-and-limitations-of---set

Here you can find all the nginx parameters: https://github.com/helm/charts/tree/master/stable/nginx-ingress

-- aitorhh
Source: StackOverflow