<p>I'm trying to patch the nginx ingress controller that follows the minikube vm.</p>

<p>Patching is successful using this command:</p>

<pre><code>$ kubectl patch deployment nginx-ingress-controller --type 'json' --namespace kube-system -p '[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--profiling"}]'

#-&gt; deployment.extensions/nginx-ingress-controller patched
</code></pre>

<p>After patching, the previous state is rolled back automatically. I can see the configuration persisted if I check just after deployment (Like below)</p>

<pre><code>$ kubectl describe deployment/nginx-ingress-controller --namespace kube-system
#--- snip
    Args:
      /nginx-ingress-controller
      --default-backend-service=$(POD_NAMESPACE)/default-http-backend
      --configmap=$(POD_NAMESPACE)/nginx-load-balancer-conf
      --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
      --udp-services-configmap=$(POD_NAMESPACE)/udp-services
      --annotations-prefix=nginx.ingress.kubernetes.io
      --report-node-internal-ip-address
      --profiling

#---
</code></pre>

<p>After rollback the config is reset:</p>

<pre><code>$ kubectl describe deployment/nginx-ingress-controller --namespace kube-system
#--- snip
    Args:
      /nginx-ingress-controller
      --default-backend-service=$(POD_NAMESPACE)/default-http-backend
      --configmap=$(POD_NAMESPACE)/nginx-load-balancer-conf
      --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
      --udp-services-configmap=$(POD_NAMESPACE)/udp-services
      --annotations-prefix=nginx.ingress.kubernetes.io
      --report-node-internal-ip-address

#---
</code></pre>

<p>I cannot see any errors in logs, which should trigger the rollback. The only I can see before the rollback is the deployment triggering shutdown on the pods due to configuration change.</p>

leifcr
<p>Due to minikube running only 1 node, and the ingress using the hostPort, rolling updates will not work for the ingress deployment.</p>

<p>After patching the ingress to use recreate instead, patching the ingress config works as expected.</p>

<p>Command to set the ingress controller to 'recreate':</p>

<pre><code>kubectl patch deployment nginx-ingress-controller --type 'json' --namespace kube-system -p '[{"op": "replace", "path": "/spec/strategy/type", "value": "Recreate"}, {"op": "replace", "path": "/spec/strategy/rollingUpdate", "value": null }]'
</code></pre>

<p>Command to set debug output logging on the nginx-ingress-controller:</p>

<pre><code>kubectl patch deployment nginx-ingress-controller --type 'json' --namespace kube-system -p '[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "-v=5"}]'
</code></pre>

<p>The ingress controller now has debug log output, and is set to recreate if the config or image changes.</p>
