Deploy Docker images to Azure Kubernetes Service cluster

  1. create userAKSCluster
    az aks create \
    –resource-group teamResources \
    –name userAKSCluster \
    –location eastus \
    –enable-addons monitoring,kube-dashboard \
    –node-count 1 \
    –attach-acr registryjrm1796 \
    –generate-ssh-keys \
    –enable-managed-identity \
    –enable-cluster-autoscaler \
    –min-count 1 \
    –max-count 2

  2. another way to create and attach to acr
    az login
    az group create –name HansResourceGroup –location eastus
    az aks create –resource-group HansResourceGroup –name myAKSCluster –node-count 1 –enable-addons monitoring –generate-ssh-keys
    az aks get-credentials –resource-group HansResourceGroup –name myAKSCluster
    az aks update -n myAKSCluster -g HansResourceGroup –attach-acr registryjrm1796
    az acr repository list –name registryjrm1796 –output table
    az acr repository show-tags –name registryjrm1796 –repository user-java –output table
    az acr list –resource-group teamResources –query "[].{acrLoginServer:loginServer}" –output table

  3. Connect to the cluster
    az aks get-credentials –resource-group teamResources –name userAKSCluster
    kubectl get nodes

  4. Deploy azure-vote sample app to AKSCluster
    root@labvm:~/azure-voting-app-redis/azure-vote# kubectl apply -f https://raw.githubusercontent.com/zhuby1973/azure/main/azure-vote.yaml
    deployment.apps/azure-vote-back created
    service/azure-vote-back created
    deployment.apps/azure-vote-front created
    service/azure-vote-front created

  5. Test the application
    root@labvm:~/azure-voting-app-redis/azure-vote# kubectl get service azure-vote-front –watch
    NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
    azure-vote-front LoadBalancer 10.0.183.193 20.75.153.18 80:32384/TCP 25s
    you can verify it on http://20.75.153.18/

    you can read the sample code on https://github.com/Azure-Samples/azure-voting-app-redis

NOTE commands to push docker images to acr, use user-java image as example:
az login
az acr login –name registryjrm1796
docker tag user-java registryjrm1796.azurecr.io/user-java:latest
docker push registryjrm1796.azurecr.io/user-java
then you should be able to find user-java in Container registries/registryjrm1796/Repositories on https://portal.azure.com/

9 Replies to “Deploy Docker images to Azure Kubernetes Service cluster”

  1. Good post. I learn something totally new and challenging on blogs I stumbleupon every day. It will always be interesting to read content from other writers and use a little something from their sites. Karola Vernor Ingmar

  2. After looking at a number of the blog posts on your blog, I truly like your technique of writing a blog. I saved it to my bookmark site list and will be checking back in the near future. Please check out my web site too and let me know how you feel.

Leave a Reply

Your email address will not be published. Required fields are marked *