Skip to content

This contains my demo for the MLSA Azure Episodes.

Notifications You must be signed in to change notification settings

Mbaoma/AKS-Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This contains my demo for the MLSA Azure Episodes.

237cdd68-2bcb-40fd-8c10-7a104d6fbdc5

In the demo, I will walk through the following:

  • creating a docker image,
  • pushing the image to Azure Container Registry
  • deploying the image to Azure Kubernetes serices.

Steps

  • Test the app locally
$ python main.py
  • Create a Docker image
$ docker login
$ docker build -t hub-username/image-name .
  • Push the image to Azure Container Registry
$ az group create --name myResourceGroup --location eastus
$ az acr create --resource-group myResourceGroup --name <acrName> --sku Basic
$ az acr login --name <acrName>
$ docker tag docker-image:tag <acrLoginServer>/image-name:tag
$ docker images
$ docker push <acrLoginServer>/image-name:tag
  • Get your image name and tag
$ az acr repository list --name <ACRname>    
$ az acr repository show-tags --name <ACRname> --repository <repo> --output table

Connect to the AKS CLI

Guide

$ az aks install-cli
$ az account set --subscription xxxx-xxx-xx-xx-xxxx
$ az aks get-credentials --resource-group myResourceGroup --name myAKSCluster
$ kubectl get nodes
  • Create a K8s cluster and deployment files.

Create Deployments

$ kubectl apply -f aks/demo-ip.yml
$ kubectl apply -f aks/demo-service.yml

Test the application

$ kubectl get service

Navigate to the IP provided under External-IP

image

Debugging

$ kubectl get pods
$ kubectl get logs <pod-name>
$ kubectl describe pod <pod-name>
$ kubectl describe service <service-name>
$ kubectl describe deployment <deployment>

Clean up

$ az group delete --name myResourceGroup --yes --no-wait