I've found a documentation about how to configure your NginX ingress controller using ConfigMap: https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/
Unfortunately I've no idea and couldn't find it anywhere how to load that ConfigMap from my Ingress controller.
My ingress controller:
helm install --name ingress --namespace ingress-nginx --set rbac.create=true,controller.kind=DaemonSet,controller.service.type=ClusterIP,controller.hostNetwork=true stable/nginx-ingress
My config map:
kind: ConfigMap apiVersion: v1 metadata: name: ingress-configmap data: proxy-read-timeout: "86400s" client-max-body-size: "2g" use-http2: "false"
My ingress:
apiVersion: extensions/v1beta1 kind: Ingress metadata: name: ingress annotations: nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" spec: tls: - hosts: - my.endpoint.net secretName: ingress-tls rules: - host: my.endpoint.net http: paths: - path: / backend: serviceName: web servicePort: 443 - path: /api backend: serviceName: api servicePort: 443
How do I make my Ingress to load the configuration from the ConfigMap?
The configuration-snippet is to add configs to locations. If you want to add a custom location to the server context, you should use the server-snippet instead: Using the annotation nginx.ingress.kubernetes.io/server-snippet it is possible to add custom configuration in the server configuration block.
An Ingress controller abstracts away the complexity of Kubernetes application traffic routing and provides a bridge between Kubernetes services and external ones. Kubernetes Ingress controllers: Accept traffic from outside the Kubernetes platform, and load balance it to pods (containers) running inside the platform.
I've managed to display what YAML gets executed by Helm using the: --dry-run --debug
options at the end of helm install
command. Then I've noticed that there controller is executed with the: --configmap={namespace-where-the-nginx-ingress-is-deployed}/{name-of-the-helm-chart}-nginx-ingress-controller
. In order to load your ConfigMap you need to override it with your own (check out the namespace).
kind: ConfigMap apiVersion: v1 metadata: name: {name-of-the-helm-chart}-nginx-ingress-controller namespace: {namespace-where-the-nginx-ingress-is-deployed} data: proxy-read-timeout: "86400" proxy-body-size: "2g" use-http2: "false"
The list of config properties can be found here.
One can pass config mag properties at the time of installation too:
helm install stable/nginx-ingress --name nginx-ingress --set controller.config.use-forwarded-headers='"true"'
NOTE: for non-string values had to use single quotes around double quotes to get it working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With