/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install git
Maybe also Git Desktop
brew install terraform
terraform -v
(check that it is above 0.12.16)
brew install kubectl
brew install helm@2
remember to set the path to /usr/local/opt/helm@2/bin
. and the version should be 2.16.1
brew install azure-cli
az login
do upgrade periodically
brew upgrade azure-cli
https://docs.docker.com/docker-for-mac/install/
Reference skip this if you are familiar with docker and its commandline interface
Follow instruction here.
Note: Please execute these command one at a time
git clone https://github.com/Azure-Samples/azure-voting-app-redis.git
cd azure-voting-app-redis/
docker-compose up -d
docker images
docker ps
then point your browser to
docker-compose down
To remove the images in docker repo. Clean things up
docker images | grep -e "azure-vote-front" -e "redis" -e "tiangolo/uwsgi-nginx-flask" | awk '{print $3}' | xargs docker rmi
Note: Get a bash shell by going to Azure Portal, click on the terminal icon on the header bar, select Bash shell and execute the following commands
az group create --name myResourceGroup --location eastus
az acr create --resource-group myResourceGroup --name myContainerRegistry --sku Basic
need to use web UI to do this; commandline gives error related to monitoring. Then continue with the rest of the instruction on my laptop.
az acr login -n myContainerRegistry
az acr list --resource-group myResourceGroup --query "[].{acrLoginServer:loginServer}" --output table
docker tag azure-vote-front mycontainerregistry.azurecr.io/azure-vote-front:v1
docker images
docker push mycontainerregistry.azurecr.io/azure-vote-front:v1
az acr repository list --name myContainerRegistry --output table
az acr repository show-tags --name myContainerRegistry --repository azure-vote-front --output table
az aks create --resource-group myResourceGroup --name myAKSCluster --node-count 2 --generate-ssh-keys --attach-acr myContainerRegistry
Be patient and wait for the command to complete. You will get an JSON dump once it is done.
to delete cluster az group delete --name myResourceGroup --yes --no-wait
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster
once it is done, you can do
cat ~/.kube/config
kubectl get nodes
or you can run kubectl on your laptop by
copy Kubernete Configuration to a file in your laptop and export it.
export KUBECONFIG=~/kube.config
where the file is
~/kube.config
remember to edit azure-vote-all-in-one-redis.yaml
kubectl apply -f azure-vote-all-in-one-redis.yaml
kubectl get pods
Wait until the two pods are running.
kubectl get service azure-vote-front --watch
To get the external IP address
kubectl scale --replicas=5 deployment/azure-vote-front
kubectl autoscale deployment azure-vote-front --cpu-percent=50 --min=3 --max=10
kubectl get hpa
from 2 to 3
az aks scale --resource-group myResourceGroup --name myAKSCluster --node-count 3
this takes a while.
vi azure-vote/azure-vote/config_file.cfg
docker-compose up --build -d
docker tag azure-vote-front mycontainerregistry.azurecr.io/azure-vote-front:v2
az acr login -n myContainerRegistry
docker push mycontainerregistry.azurecr.io/azure-vote-front:v2
kubectl set image deployment azure-vote-front azure-vote-front=mycontainerregistry.azurecr.io/azure-vote-front:v2
Read
- https://github.com/microsoft/bedrock/blob/master/docs/fabrikate/README.md
- https://github.com/microsoft/bedrock/blob/master/docs/azure-simple/README.md
- https://docs.microsoft.com/en-us/azure/active-directory/develop/app-objects-and-service-principals
- https://github.com/dennisseah/bedrock-deploy-demo
- Password of SP is shown after creation. We can query for it unless we reset the SP
- use
terraform destroy -var-file=testazuresimple.tfvars
to teardown the setup