<p>I have a cluster, I created namespaces for different teams. Then, I tried to apply an ingress to one namespace with this command <code>kubectl apply -f ing2_dev_plat.yaml -n namespace_name</code>.</p>
<p>After, this error was thrown. How can I properly configure the work of ingress controller in several namespaces?</p>
<p>Nginx ingress contoller service is in default namespace.</p>
<pre><code>Error from server (BadRequest): error when creating &quot;ing2_dev_plat.yaml&quot;: admission webhook &quot;validate.nginx.ingress.kubernetes.io&quot; denied the request:
-------------------------------------------------------------------------------
Error: exit status 1
2022/02/11 09:17:49 [warn] 3250#3250: the &quot;http2_max_field_size&quot; directive is obsolete, use the &quot;large_client_header_buffers&quot; directive instead in /tmp/nginx-cfg1414424955:143
nginx: [warn] the &quot;http2_max_field_size&quot; directive is obsolete, use the &quot;large_client_header_buffers&quot; directive instead in /tmp/nginx-cfg1414424955:143
2022/02/11 09:17:49 [warn] 3250#3250: the &quot;http2_max_header_size&quot; directive is obsolete, use the &quot;large_client_header_buffers&quot; directive instead in /tmp/nginx-cfg1414424955:144
nginx: [warn] the &quot;http2_max_header_size&quot; directive is obsolete, use the &quot;large_client_header_buffers&quot; directive instead in /tmp/nginx-cfg1414424955:144
2022/02/11 09:17:49 [warn] 3250#3250: the &quot;http2_max_requests&quot; directive is obsolete, use the &quot;keepalive_requests&quot; directive instead in /tmp/nginx-cfg1414424955:145
nginx: [warn] the &quot;http2_max_requests&quot; directive is obsolete, use the &quot;keepalive_requests&quot; directive instead in /tmp/nginx-cfg1414424955:145
2022/02/11 09:17:49 [emerg] 3250#3250: duplicate location &quot;/&quot; in /tmp/nginx-cfg1414424955:1045
nginx: [emerg] duplicate location &quot;/&quot; in /tmp/nginx-cfg1414424955:1045
nginx: configuration file /tmp/nginx-cfg1414424955 test failed
</code></pre>
<p><a href="https://i.stack.imgur.com/liqRY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/liqRY.png" alt="enter image description here" /></a></p>

<p>As I said in my comment under the question:</p>
<pre class="lang-text prettyprint-override"><code>nginx: [emerg] duplicate location &quot;/&quot; in /tmp/nginx-cfg1414424955:1045
</code></pre>
<p>may indicate you have the same location defined twice.</p>
<p>If you have any other Ingress resources with <code>path: /</code>, you have to edit those accordingly.</p>
<p>You can get all Ingress resources with their paths with</p>
<pre class="lang-text prettyprint-override"><code>kubectl get ingress -A -o=jsonpath='{range .items[*]}{.metadata.name}{&quot;\t&quot;}{.spec.rules[*].http.paths[*].path}{&quot;\n&quot;}{end}'
</code></pre>
