- Define variables
SUBSCRIPTION_ID=""
KUBE_GROUP=""
KUBE_NAME=""
LOCATION="northeurope"
REGISTRY_NAME=""
REGISTRY_PASSWORD=""
REGISTRY_URL="someregistry.azurecr.io"
APPINSIGHTS_KEY=
REDIS_HOST=
REDIS_AUTH=
- Build images
docker build -t js-calc-frontend .
docker build -t js-calc-backend .
docker build -t go-calc-backend .
- Tag Images
docker tag js-calc-frontend "$REGISTRY_URL/calc/js-calc-frontend"
docker tag js-calc-backend "$REGISTRY_URL/calc/js-calc-backend"
docker tag go-calc-backend "$REGISTRY_URL/calc/go-calc-backend"
- Login
docker login --username $REGISTRY_NAME --password $REGISTRY_PASSWORD $REGISTRY_URL
- Push images
docker push "$REGISTRY_URL/calc/js-calc-frontend"
docker push "$REGISTRY_URL/calc/js-calc-backend"
docker push "$REGISTRY_URL/calc/go-calc-backend"
or use the images from the docker hub
https://hub.docker.com/r/denniszielke/go-calc-backend/ https://hub.docker.com/r/denniszielke/js-calc-backend/ https://hub.docker.com/r/denniszielke/js-calc-frontend/
kubectl create secret docker-registry kuberegistry --docker-server 'myveryownregistry-on.azurecr.io' --docker-username 'username' --docker-password 'password' --docker-email '[email protected]'
or
kubectl create secret docker-registry kuberegistry --docker-server $REGISTRY_URL --docker-username $REGISTRY_NAME --docker-password $REGISTRY_PASSWORD --docker-email '[email protected]'
- Application insights key
kubectl create secret generic appinsightsecret --from-literal=appinsightskey=$APPINSIGHTS_KEY
- Redis cache host and redis cache auth key
kubectl create secret generic rediscachesecret --from-literal=redishostkey=$REDIS_HOST --from-literal=redisauthkey=$REDIS_AUTH
Use the full-acr-depl.yml file for deployment and modify it to your needs
kubectl apply -f 0-full-acr-depl.yml --record
Update the deployment and change from the js backend to the go backend
kubectl apply -f 1-full-acr-depl.yml --record
Watch the pods change one by one
kubectl get pods -l role=calcbackend
Check status
kubectl rollout status deployments calcbackend
Check the rollout history of a deployment
kubectl rollout history deployment/calcbackend
Rolling back to a specific revision rollout
kubectl rollout undo deployment/calcbackend --to-revision=2