I am trying to install the nginx-ingress controller through Helm but I would like to use a custom nginx template. However, I am having trouble understanding how that works. According to the docs I can use a parameter called controller.customTemplate.configMapName
. The description of the parameter is.
configMap containing a custom nginx template
I created a ConfigMap containing the nginx template as follows
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-template
data:
nginx.tmpl: nginx.tmpl
The nginx.tmpl
contains the nginx configuration + plus a custom header on every server block. I install the chart as follows:
helm install stable/nginx-ingress --namespace kube-system --set controller.customTemplate.configMapName="nginx-template"
However, I'm getting the following error when running above command.
Error: release listless-ant failed: Deployment.apps "listless-ant-nginx-ingress-controller" is invalid: [spec.template.spec.volumes[0].configMap.items[0].key: Required value, spec.template.spec.containers[0].volumeMounts[0].name: Not found: "nginx-template-volume"]
My question is, what am I doing wrong?
I think you also need to set controller.customTemplate.configMapKey
to nginx.tmpl
.
The default location of nginx configuration template is /etc/nginx/template/nginx.tmpl
And you will have to configure this as a volume mount.
You can follow the steps mentioned in the official docs in-case if you are using a custom nginx.conf https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/custom-template/