I am using classic editor to create a release pipeline to deploy to Azure Kubernetes Service, however, I keep getting the error of InvalidImageName after deploying in Azure Kubernetes Service (AKS). The issue is due to aks not being able to find the specified image in Azure Container Registries (ACR) where the docker image tag ${TAG} variable cannot seem to be replaced by the build number from the pipeline $(Build.BuildId).
My Azure Container Registries (ACR) repositories
The error screenshot in aks:
I have tried to create variable in the release pipeline to assign the value to the TAG variable. Thereafter, I went on to create a 'Command line' task step to set the value into the deployment.yml file.
It is setting the value as shown below. However, when I run the kubectl apply
command to run the deployment.yml file, the TAG is not showing the build number. I would greatly appreciate any help on this.
Prior to seeking help, I have try out some of the stackoverflow answers from this questions, but was unable to do so How to kubernetes "kubectl apply" does not update existing deployments How to provide docker image tag dynamically to docker-compose.yml in Azure Release Pipeline Task?