Today we are going to see another important topic, how we can deploy an image from Azure container registry to any Kubernetes environment, and also let’s see how to do via Argo CD also.
Azure Container Registry
Azure Container Registry allows you to build, store, and manage container images and artifacts in a private registry for all types of container deployments. Use Azure container registries with your existing container development and deployment pipelines. Use Azure Container Registry Tasks to build container images in Azure on-demand, or automate builds triggered by source code updates, updates to a container’s base image, or timers.
Features:
Registry service tiers — Registries are available in three tiers: Basic, Standard, and Premium, each of which supports webhook integration, registry authentication with Azure Active Directory, and delete functionality. Take advantage of local, network-close storage of your container images by creating a registry in the same Azure location as your deployments. Use the geo-replication feature of Premium registries for advanced replication and container image distribution scenarios.
Security and access — You log in to a registry using the Azure CLI or the standard docker login command. Azure Container Registry transfers container images over HTTPS, and supports TLS to secure client connections.
You control access to a container registry using an Azure identity, an Azure Active Directory-backed service principal, or a provided admin account. Use Azure role-based access control (Azure RBAC) to assign users or systems fine-grained permissions to a registry.
Security features of the Premium service tier include content trust for image tag signing, and firewalls and virtual networks (preview) to restrict access to the registry. Microsoft Defender for Cloud optionally integrates with Azure Container Registry to scan images whenever an image is pushed to a registry.
Supported images and artifacts — Grouped in a repository, each image is a read-only snapshot of a Docker-compatible container. Azure container registries can include both Windows and Linux images. You control image names for all your container deployments. In addition to Docker container images, Azure Container Registry stores related content formats such as Helm charts and images built to the Open Container Initiative (OCI) Image Format Specification.
Automated image builds — Use Azure Container Registry Tasks (ACR Tasks) to streamline building, testing, pushing, and deploying images in Azure. Multi-step tasks provide step-based task definition and execution for building, testing, and patching container images in the cloud. Task steps define individual container image build and push operations. They can also define the execution of one or more containers, with each step using the container as its execution environment.
Create a Registry:
As this is well documented in Microsoft portal, you can refer for UI https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-portal?tabs=azure-cli and for Azure CLI https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-azure-cli
Using Terraform:
resource "azurerm_container_registry" "acr" {
name = "foxutech"
resource_group_name = azurerm_resource_group.rg.name
location = var.location
sku = "Standard"
admin_enabled = true tags = {
environment = "Staging"
}
}
Demo
Build or Pull the docker image:
If you have Dockerfile you can build and use that or we can pull any public image and try to push to azure container registry. In this let’s pull nginx image and push to ACR.
Pull the nginx public image
# docker pull nginx
Check the images and get image iD
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest b692a91e4e15 3 days ago 142MB
Tag the image to your registry
# docker tag b692a91e4e15 foxutech.azurecr.io/nginx:latest
Note: change to your registry name and image name.
Login to your registry, you can get the credential from ACR portal in access keys section.
# docker login foxutech.azurecr.io
Push the image to your registry
# docker push foxutech.azurecr.io/nginx:latest
Verify Docker Image in ACR Repository
Continue Reading on https://foxutech.com/how-to-deploy-an-azure-container-registry-image-in-kubernetes/