<p>I'm trying to install an nginx ingress controller into an Azure Kubernetes Service cluster using helm. I'm following <a href="https://learn.microsoft.com/en-us/azure/aks/ingress-static-ip" rel="nofollow noreferrer">this Microsoft guide</a>. It's failing when I use helm to try to install the ingress controller, because it needs to pull a &quot;kube-webhook-certgen&quot; image from a local Azure Container Registry (which I created and linked to the cluster), but the kubernetes pod that's initially scheduled in the cluster fails to pull the image and shows the following error when I use <code>kubectl describe pod [pod_name]</code>:</p>
<pre><code>failed to resolve reference &quot;letsencryptdemoacr.azurecr.io/jettech/kube-webhook-certgen@sha256:f3b6b39a6062328c095337b4cadcefd1612348fdd5190b1dcbcb9b9e90bd8068&quot;: failed to authorize: failed to fetch anonymous token: unexpected status: 401 Unauthorized]
</code></pre>
<p><a href="https://learn.microsoft.com/en-us/azure/aks/ingress-static-ip#ip-and-dns-label" rel="nofollow noreferrer">This section describes using helm to create an ingress controller</a>.</p>
<p>The guide describes creating an Azure Container Registry, and link it to a kubernetes cluster, which I've done successfully using:</p>
<pre><code>az aks update -n myAKSCluster -g myResourceGroup --attach-acr &lt;acr-name&gt;
</code></pre>
<p>I then import the required 3rd party repositories successfully into my 'local' Azure Container Registry as detailed in the guide. I checked that the cluster has access to the Azure Container Registry using:</p>
<pre><code>az aks check-acr --name MyAKSCluster --resource-group myResourceGroup --acr letsencryptdemoacr.azurecr.io
</code></pre>
<p>I also used the Azure Portal to check permissions on the Azure Container Registry and the specific repository that has the issue. It shows that both the cluster and repository have the ACR_PULL permission)</p>
<p>When I run the helm script to create the ingress controller, it fails at the point where it's trying to create a kubernetes pod named <code>nginx-ingress-ingress-nginx-admission-create</code> in the ingress-basic namespace that I created. When I use <code>kubectl describe pod [pod_name_here]</code>, it shows the following error, which prevents creation of the ingress controller from continuing:</p>
<pre><code>Failed to pull image &quot;letsencryptdemoacr.azurecr.io/jettech/kube-webhook-certgen:v1.5.1@sha256:f3b6b39a6062328c095337b4cadcefd1612348fdd5190b1dcbcb9b9e90bd8068&quot;: [rpc error: code = NotFound desc = failed to pull and unpack image &quot;letsencryptdemoacr.azurecr.io/jettech/kube-webhook-certgen@sha256:f3b6b39a6062328c095337b4cadcefd1612348fdd5190b1dcbcb9b9e90bd8068&quot;: failed to resolve reference &quot;letsencryptdemoacr.azurecr.io/jettech/kube-webhook-certgen@sha256:f3b6b39a6062328c095337b4cadcefd1612348fdd5190b1dcbcb9b9e90bd8068&quot;: letsencryptdemoacr.azurecr.io/jettech/kube-webhook-certgen@sha256:f3b6b39a6062328c095337b4cadcefd1612348fdd5190b1dcbcb9b9e90bd8068: not found, rpc error: code = Unknown desc = failed to pull and unpack image &quot;letsencryptdemoacr.azurecr.io/jettech/kube-webhook-certgen@sha256:f3b6b39a6062328c095337b4cadcefd1612348fdd5190b1dcbcb9b9e90bd8068&quot;: failed to resolve reference &quot;letsencryptdemoacr.azurecr.io/jettech/kube-webhook-certgen@sha256:f3b6b39a6062328c095337b4cadcefd1612348fdd5190b1dcbcb9b9e90bd8068&quot;: failed to authorize: failed to fetch anonymous token: unexpected status: 401 Unauthorized]
</code></pre>
<p>This is the helm script that I run in a linux terminal:</p>
<pre><code>helm install nginx-ingress ingress-nginx/ingress-nginx --namespace ingress-basic --set controller.replicaCount=1 --set controller.nodeSelector.&quot;kubernetes\.io/os&quot;=linux --set controller.image.registry=$ACR_URL --set controller.image.image=$CONTROLLER_IMAGE --set controller.image.tag=$CONTROLLER_TAG --set controller.image.digest=&quot;&quot; --set controller.admissionWebhooks.patch.nodeSelector.&quot;kubernetes\.io/os&quot;=linux --set controller.admissionWebhooks.patch.image.registry=$ACR_URL --set controller.admissionWebhooks.patch.image.image=$PATCH_IMAGE --set controller.admissionWebhooks.patch.image.tag=$PATCH_TAG --set defaultBackend.nodeSelector.&quot;kubernetes\.io/os&quot;=linux --set defaultBackend.image.registry=$ACR_URL --set defaultBackend.image.image=$DEFAULTBACKEND_IMAGE --set defaultBackend.image.tag=$DEFAULTBACKEND_TAG --set controller.service.loadBalancerIP=$STATIC_IP --set controller.service.annotations.&quot;service\.beta\.kubernetes\.io/azure-dns-label-name&quot;=$DNS_LABEL
</code></pre>
<p>I'm using the following relevant environment variables:</p>
<pre><code>$ACR_URL=letsencryptdemoacr.azurecr.io
$PATCH_IMAGE=jettech/kube-webhook-certgen
$PATCH_TAG=v1.5.1
</code></pre>
<p>How do I fix the authorization?</p>

<p>It seems like the issue is caused by the new ingress-nginx/ingress-nginx helm chart release. I have fixed it by using version 3.36.0 instead of the latest (4.0.1).</p>
<pre><code>helm upgrade -i nginx-ingress ingress-nginx/ingress-nginx \
--version 3.36.0 \
...
</code></pre>
