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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0Mzk4NjEsIm5iZiI6MTczOTQzOTU2MSwicGF0aCI6Ii80OTc5MTQ5OC8yMzg1MjE2MTAtMmQxZTBkNDgtMWM2Yi00ZThiLTljMTMtOGVjOThlYjgzYmFkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDA5MzkyMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY4YWY4OTM1ZmNlNGZhZjQ5Y2QxMDllMTAxN2RlNmI1YjEwOWVhMzk1ZTc2ZTQxMWM5ZTI1MzZkM2ZmM2E5MDEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.8wptB2TCr3QPiUplPGfZ1TGt0iCCIJJoCZ2zIHGlXy4)
$ 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