AZ, ACI, AKS, ACS in 5 minutes top chrono !
Ok maybe 10 to 15…that was just a bait ! But this is not the 80s anymore :)
Microsoft has been coming on strong these past few months and even years since Satya Nadella took over. Cloud seems to be the number one priority over there with a decisive move towards open source friendliness. No doubt that you have noticed all the rock stars joining the developer advocate team, but also the Deis acquisition and of course Brendan Burns leading their container efforts.
So it is about time that I look at Azure and try their new services, mostly still in preview, around containers. As always this will be a step by step walkthrough in the hope that 5 minutes reading this blog will save you 50 minutes figuring out yourselves. Who does not like a x10 return ?
First get your free account and do not get angry because you have to enter your credit card even though they won’t charge it during your free trial period and $200 free credit.
Then jump on the terminal:
Install the `az` CLI
Of course you can do things via the dashboard , but I am a CLI person so I use the terminal. Sadly I sold my soul to OSX so I got the CLI via
brew like so:
$ brew update
$ brew install azure-cli
If you are not on OSX check the docs. Then you can get your CLI to login using
az login and get the redirection to your browser and sign-in.
$ az login
To sign in, use a web browser to open the page https://aka.ms/devicelogin and enter the code B4JGSFDGSV to authenticate.
“name”: “Free Trial”,
That’s it. If you manage to get this login to work you are off to the races.
The default behavior of the CLI is to output raw json, to get a table output by default just run
az configure which is an interactive configuration prompt.
Azure Container Instances (ACI)
Container Instances is the easiest service to check, it allows you to deploy containers quickly. Strangely, on the dashboard you access ACI through the marketplace (ping @ralph_squillace), just move on…
Follow the quick start
All your resources need to belong to a resource group so you need to create one:
$ az group create --name bitnami --location eastus
Then launch your container:
$ az container create --resource-group bitnami --name nginx --image bitnami/nginx --ip-address public --ports 8080
Note that the
bitnami/nginx container is a non-root container that serves on a non privileged port.
The CLI gives you standard commands to list, get the logs and delete containers.
$ az container list -g bitnami
Name ResourceGroup ProvisioningState Image IP:ports CPU/Memory OsType Location
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
nginx bitnami Succeeded nginx 184.108.40.206:80 1.0 core/1.5 gb Linux eastus
To get the logs of the container:
$ az container logs -n nginx -g bitnami
Welcome to the Bitnami nginx container
Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-nginx
Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-nginx/issues
Send us your feedback at email@example.com
nami INFO Initializing nginx
nginx INFO ==> nginx.conf not found. Applying bitnami configuration…
nami INFO nginx successfully initialized
INFO ==> Starting nginx…
And of course do not forget to delete it:
$ az container delete -n nginx -g bitnami
This is pretty straightforward, it allows you to deploy a single container and get a public IP to reach whatever application is running. In Kubernetes land this is pretty close to
kubectl run .
AKS is the Azure Kubernetes Engine. While you can deploy Kubernetes using the Azure Container Service (ACS), AKS is a managed k8s service that competes directly with Google GKE.
ACS can technically allow you to create a Swarm, Mesos or k8s cluster. But it seems that the branding is changing a bit here or I missed an announcement.
Check the official AKS walkthrough or follow the steps below:
If you have never used Azure you will need to register a few providers namely for Compute, Network and Storage. The three steps below will do it but note that it may take a few minutes for the registration to complete.
$ az provider register -n Microsoft.Compute
$ az provider register -n Microsoft.Network
$ az provider register -n Microsoft.Storage
Once the providers are registered you are ready to create your Kubernetes cluster:
$ az aks create --resource-group bitnami --name kube --node-count 3 --generate-ssh-keys
This is very similar to the GKE CLI even if more oriented towards optional arguments and not a sentence based CLI.
Once the cluster is created, get the credentials for it and you can then use your familiar Kubernetes
$ az aks get-credentials -g bitnami -n kube
Be a bit patient, you will be able to reach the master before the nodes are actually up and ready. Ultimately:
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
aks-nodepool1–31140464–0 Ready agent 1m v1.7.7
aks-nodepool1–31140464–1 Ready agent 40s v1.7.7
aks-nodepool1–31140464–2 Ready agent 52s v1.7.7
From there you are on Kubernetes. If you don’t know Kubernetes, then take 2 hours and 15 minutes and watch my screencast :) _shameless plug_
$ kubeapps up
$ kubeapps dashboard