<p>I am trying to automate build and deployment using gitlab CI. for this,i have added few steps like build, test, quality checks, review&amp;deployment. Currently i am facing an issue on deployment, i am creating the docker image and pushing those images into the azure container registry and from there i'm trying to deploy on azure kubernetes by using helm. also i added ingress on the same. but due to some issue docker image is not able to pull the image on kubernetes and throwing below error-
<a href="https://i.stack.imgur.com/LuFhQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LuFhQ.png" alt="enter image description here"></a>
and my gitlab ci pipeline getting success.
<a href="https://i.stack.imgur.com/P7mhz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P7mhz.png" alt="enter image description here"></a>
This is my deployment function which is written in .gitlab-ci.yml file-
<a href="https://i.stack.imgur.com/fBMp3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fBMp3.png" alt="enter image description here"></a></p>

Pavan
<p>you need to grant AKS service principal <code>ACRPull</code> permission. that will allow it to silently auth to the ACR without you doing anything (you dont even need to create a docker secret in kubernetes).</p>

<pre><code>AKS_RESOURCE_GROUP=myAKSResourceGroup
AKS_CLUSTER_NAME=myAKSCluster
ACR_RESOURCE_GROUP=myACRResourceGroup
ACR_NAME=myACRRegistry

# Get the id of the service principal configured for AKS
CLIENT_ID=$(az aks show --resource-group $AKS_RESOURCE_GROUP --name $AKS_CLUSTER_NAME --query "servicePrincipalProfile.clientId" --output tsv)

# Get the ACR registry resource id
ACR_ID=$(az acr show --name $ACR_NAME --resource-group $ACR_RESOURCE_GROUP --query "id" --output tsv)

# Create role assignment
az role assignment create --assignee $CLIENT_ID --role acrpull --scope $ACR_ID
</code></pre>

<p><a href="https://learn.microsoft.com/bs-latn-ba/azure/container-registry/container-registry-auth-aks" rel="nofollow noreferrer">https://learn.microsoft.com/bs-latn-ba/azure/container-registry/container-registry-auth-aks</a></p>
