Search code examples
azureazure-aksazure-policy

What is the regex pattern to be used with AKS allowed container images built-in policy?


I am using the AKS cluster. I have enabled the Policy add-on feature. And have assigned the built-in policy with definition name Kubernetes cluster containers should only use allowed images

During the assignment, I have included the allowed regex pattern as ^.+mcr.microsoft.com/.+$ This is the image source I have included in my Pod YAML "mcr.microsoft.com/v2/mcr/hello-world/tags/list" But it gets denied. Since I am not familiar with the Regex pattern kindly help me to use the right input.


Solution

  • Remove the first .+ from your pattern. So ^mcr.microsoft.com\/.+$

    This means that the image name actually starts exactly with "mcr.microsoft.com..."