<p>There's <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#server-tokens" rel="nofollow noreferrer">a setting</a> to turn off the NGINX Server header, but I'm new to Kubernetes and Helm so I don't actually know how to set it.</p>

<p>I've tried to turn off server tokens like so:</p>

<pre><code>helm upgrade --reuse-values nginx-ingress stable/nginx-ingress -ndefault --set controller.config.server-tokens='"false"'
</code></pre>

<p>Which is indeed reflected when I read back the chart values:</p>

<pre><code>❯ helm get values nginx-ingress -ndefault

USER-SUPPLIED VALUES:
controller:
  config:
    server-tokens: '"false"'
  publishService:
    enabled: true
</code></pre>

<p>And in the YAML:</p>

<pre><code>❯ kubectl get -n default configmap  ingress-controller-leader-nginx -oyaml
apiVersion: v1
data:
  server-tokens: "false"
kind: ConfigMap
metadata:
  ...
</code></pre>

<p>But it doesn't seem to be applied against the internal <code>nginx.conf</code>:</p>

<pre><code>❯ kubectl exec -ndefault nginx-ingress-controller-b545558d8-829dz -- cat /etc/nginx/nginx.conf | grep tokens
        server_tokens on;
</code></pre>

<p>And also my web-server is still sending the <code>server:</code> header.</p>

<p>Do I have to reboot the service for the ConfigMap to be reflected or what? How do I do this?</p>

mpen
<p><del>I think it has to be a capital F in <code>False</code>.</del> Doesn't need to be. It just wasn't taking before. I don't know why. <a href="https://github.com/nginxinc/kubernetes-ingress/issues/226#issuecomment-391183286" rel="nofollow noreferrer">This</a> and <a href="https://github.com/nginxinc/kubernetes-ingress/issues/226#issuecomment-391210099" rel="nofollow noreferrer">this</a> both work.</p>

<pre><code>❯ kubectl get configmap -ndefault nginx-ingress-controller -oyaml
apiVersion: v1
data:
  server-tokens: "False"
kind: ConfigMap
metadata:
  annotations:
    meta.helm.sh/release-name: nginx-ingress
    meta.helm.sh/release-namespace: default
  creationTimestamp: "2020-06-19T06:37:21Z"
  labels:
    app: nginx-ingress
    app.kubernetes.io/managed-by: Helm
    chart: nginx-ingress-1.37.0
    component: controller
    heritage: Helm
    release: nginx-ingress
  name: nginx-ingress-controller
  namespace: default
  resourceVersion: "7130237"
  selfLink: /api/v1/namespaces/default/configmaps/nginx-ingress-controller
  uid: 633efe3a-73cf-4c40-8e40-581937e367e2
</code></pre>

<p>You can do this manually by editing the configmap via <code>kubectl edit configmap</code> and then deleting the controller pod, or you can set it via helm values:</p>

<pre><code>helm get values nginx-ingress -ndefault -oyaml &gt; tmp/nginx-ingress-values.yaml
</code></pre>

<p>Change to:</p>

<pre><code>controller:
  config:
    server-tokens: "False"
  publishService:
    enabled: true
</code></pre>

<p>And apply it:</p>

<pre><code>helm upgrade nginx-ingress stable/nginx-ingress -f tmp/nginx-ingress-values.yaml -ndefault
</code></pre>

<p>Delete the controller pod for good measure.</p>

<p>Grep it:</p>

<pre><code>kubectl exec -ndefault nginx-ingress-controller-b545558d8-gmz64  -- cat /etc/nginx/nginx.conf | grep tokens
</code></pre>

<p>Confirm your headers in Chrome dev tools:</p>

<p><img src="https://i.stack.imgur.com/0OTNA.png" alt=""></p>

<hr>

<p>Perhaps more simply this would have worked:</p>

<pre><code>helm upgrade --reuse-values nginx-ingress stable/nginx-ingress -ndefault --set-string controller.config.server-tokens=false
</code></pre>

<p>But my config is working now so I'm not going to try it.</p>
