Skip to content

martimolanes/demoAzure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo

  1. Create flask helloWorld app
  2. Containerized in docker
  3. Upload image -> AzureContainerRegistry
  4. Create Azure Kubernetes Service
  5. Deploy 2 k8s pods of our webapp with a LoadBalancer

Create flask helloWorld app

# create pyenv
pip install -r requirements.txt
python app.py
# access by http://localhost:80

Containerized in docker

sudo docker build -t my-aks-app .
sudo docker run -p 4000:80 my-aks-app
# access by http://localhost:4000

Upload image -> AzureContainerRegistry

az login
az acr show --name testmartinho --query loginServer --output table
sudo docker login testmartinho.azurecr.io
sudo docker tag my-aks-app:latest testmartinho.azurecr.io/test-aks:latest
sudo docker push testmartinho.azurecr.io/test-aks:latest

Create Azure Kubernetes Service

az acr repository list --name testmartinho --output table
  • deployment.yaml
  • azurePull
kubectl create secret docker-registry acr-secret \
  --docker-server=testmartinho.azurecr.io \
  --docker-username=testmartinho \
  --docker-password= \
  [email protected]
kubectl apply -f deployment.yaml
kubectl get pods

Deploy 2 k8s pods of our webapp with a LoadBalancer

  • service.yaml
kubectl apply -f service.yaml
kubectl get svc my-aks-app-service

Troubleshouting

kubectl get deployment my-aks-app-deployment
kubectl describe pod [pod-name]