How can I get started with Kubernetes using Azure Container Service?


 

I had a university customer in the northwest ask me about how to get quickly started with the newer Kubernetes cluster deployed via Azure Container Service (ACS).

I had not played with it much so I put together a quick walkthrough of how to get a Kubernetes cluster built using Azure Container Service and how it can be paired with Helm.

What is Azure Container Service?

ACS makes it easier to create, configure, and manage a cluster of virtual machines that are preconfigured on containerized applications.  It leverages the Docker format to ensure portability. You can scale to thousands or 10s of thousand of containers.

What is an Azure Container Service Kubernetes cluster?

image

Kubernetes is an open source container cluster manager used to deploy, scale and operate applications across a number of host computers. It has been recently added to Azure Container Service in addition to two other container orchestrators Mesosphere DC/OS and Docker Swarm.

What do I get when I deploy an ACS Kubernetes default cluster?

image

When you deploy an ACS Kubernetes default cluster it will automatically create one master VM and three node VMs. You can also create a customized ACS Kubernetes cluster via JSON with 1,3 or 5 master nodes, specific HW VM skus, and up to 100 agent nodes. ACS will also automatically configure VNet, a load balancer, NAT, etc. It will horizontally scale your agent nodes as you grow your container footprint so ACS has a nice advantage over installing Kubernetes without ACS in VMs which would take quite a bit longer get this running.

ACS provides the following Kubernetes features:

  • Horizontal scaling
  • Service discovery and load balancing
  • Secrets and configuration management
  • API-based automated rollouts and rollbacks
  • Self-healing

ACS with Kubernetes Prerequisites

Bash shell (I used Bash on Windows 10 see here)

Azure CLI 2.0 – install from here

To install Azure CLI I ran this from Bash:

curl -L https://aka.ms/InstallAzureCli | bash

image

Login into Azure via Bash:

az login

image

Set the right subscription context if needed (optional):

az account set --subscription "ab12c34d-56a7-9876-b4ba-a0b1cd3f1234"
az account show

image

 

Creating the Kubernetes Cluster

From Bash I ran (may need to tweak for Command Prompt Azure CLI):

DNS_PREFIX=kub07
CLUSTER_NAME=kubclus07
RESOURCE_GROUP=kub-rg-07 
(I pre-created this resource group)
az acs create --orchestrator-type=kubernetes --resource-group $RESOURCE_GROUP --name=$CLUSTER_NAME --dns-prefix=$DNS_PREFIX --generate-ssh-keys

image

It will take a bit but if it worked you will see a status of succeeded:

image

If all went well, in Azure portal you will see the Kubernetes cluster master and three nodes deployed as virtual machines. You can change the VM HW profiles if you need more CPU/RAM, etc.

image

Next you need to install the Kubernetes CLI to manage the cluster:

az acs kubernetes install-cli

image

Grab the Kubernetes cluster config locally:

az acs kubernetes get-credentials --resource-group=$RESOURCE_GROUP --name=$CLUSTER_NAME

image

Run kubectl get nodes to see the cluster nodes and master:

image

See more on ACS CLI commands here.

Install applications to the Kubernetes cluster

I installed NGIX from CLI to see if it worked:

kubectl run nginx --image nginx

image

You have to publish the service to the world:

kubectl expose deployments nginx --port=80 --type=LoadBalancer

image

You need to get the public IP for nginx:

watch 'kubectl get svc'

It may take a few minutes to get this external/public IP.

Browse to the External IP and it should show the Nginx start page:

 

image

Installing Helm in the Kubernetes cluster

I also wanted to check out what Deis provided with Kubernetes since we just acquired them. They have a great open source solution called Helm. I installed Helm in the cluster. It deploys a Tiller management server within the cluster:

curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh

chmod 700 get_helm.sh $

./get_helm.sh

image

Helm Tiller management server deployed in Kubernetes:

image

Next I went to KubeApps website which is like a registry for Helm charts (application packages) you can deploy to Kubernetes using Helm here:

image

If you prefer you can view Helm charts using Helm CLI run:

Helm search

image

 

I decided to install DokuWiki from the Helm charts library:

image

You grab the helm command line to install:

helm install stable/dokuwiki

image

I ran watch ‘kubectl get svc’ to get the External IP to browse to and then browsed to make sure dokuwiki deployed:

image

Next I installed WordPress:

helm install stable/wordpress

image

I ran watch ‘kubectl get svc’ to list the external IPs:

image

Wait a few minutes for the external IP to show up.

Browse to the external IP to test WordPress:

image

I can see the power of the combination of Kubernetes and Helm together as it makes brand new users like me with Kubernetes able to quickly get popular applications running in Kubernetes without much effort.

More on Helm here.

Manage Kubernetes from the browser management UI

You have to setup a proxy listener to manage via the browser:

To enable the listener from Bash I ran: kubectl proxy

image

With the listener running, visit this URL to see the Kubernetes interface:

http://localhost:8001/ui

Here you can see all the apps I deployed to the Kubernetes cluster:

image

Excellent Kubernetes ACS documentation here and a useful Kubernetes user guide here.

 

Enjoy quickly setting up and using Kubernetes containers via Azure Container Services!

Comments (0)

Skip to main content