This contains my demo for the MLSA Azure Episodes.
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.
- 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
$ 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.
$ kubectl apply -f aks/demo-ip.yml
$ kubectl apply -f aks/demo-service.yml
$ kubectl get service
Navigate to the IP provided under External-IP
![image](https://private-user-images.githubusercontent.com/49791498/238521610-2d1e0d48-1c6b-4e8b-9c13-8ec98eb83bad.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMDMxNzQsIm5iZiI6MTcyNDEwMjg3NCwicGF0aCI6Ii80OTc5MTQ5OC8yMzg1MjE2MTAtMmQxZTBkNDgtMWM2Yi00ZThiLTljMTMtOGVjOThlYjgzYmFkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDIxMjc1NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTlhNDNjNTAwNGU0ZWU4ZTEwOWExNWMyN2ZkOTRmNTkxZTkzYjYzYWY4YWJmNzg4YjVkMDk5MmIyY2E1MGQ5OWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.R_CbI-6jbULYLhi42vR0yhkXDnsFjMTIYwtqGlnkys4)
$ kubectl get pods
$ kubectl get logs <pod-name>
$ kubectl describe pod <pod-name>
$ kubectl describe service <service-name>
$ kubectl describe deployment <deployment>
$ az group delete --name myResourceGroup --yes --no-wait