Quantcast
Channel: MSDN Blogs
Viewing all articles
Browse latest Browse all 5308

How can I get started with Kubernetes on Azure Container Services

$
0
0

 

I had a university customer in the Northwest ask me about how to get quickly started with the new Kubernetes on Azure Container Services (ACS).

I had not played with it so I put together a quick walkthrough of how to get Kubernetes going via Azure Container Services and how it can be paired with Helm.

What is Kubernetes with Azure Container Service?

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 it from ACS?

image

When you deploy Kubernetes from ACS it will automatically create one master VM and two or three node VMs. ACS will also automatically configure VNet, a load balancer, NAT, etc. It will also autoscale your hosts 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 with Kubernetes Prerequisites

Bash or equivalent (I used Bash on Windows 10 see here)

Azure CLI 2.0 – install from here

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

Next you want to create 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

I installed NGIX from CLI to see if it worked:

kubectl run nginx –image nginx

image

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

 

image

I also wanted to check out what Deis provided with Kubernetes since we just acquired them. They have a product called Helm. I installed Helm in the cluster. It deploys a 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

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

I decided to install DokuWiki:

image

You grab the helm command line to install:

helm install stable/dokuwiki

image

I ran 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 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 beginners like me with Kubernetes able to quickly get popular applications running in Kubernetes without much effort.

If you want to manage Kubernetes from the browser

Run: kubectl proxy

image

Hit 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

Good Kubernetes user guide here.

 

Enjoy setting up and using Kubernetes containers in Azure Container Services!


Viewing all articles
Browse latest Browse all 5308

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>