Skip to main content
Khader Syed

Kubernetes Setup Using Azure ACS Engine - Part II

Continuing on from Part I

Now that we have the acs-engine binary, we can create a template and launch the kubernetes cluster.

Before we proceed, it doesn’t hurt to pull a fresh copy of acs-engine, bootstrap and build it.

$ git clone https://github.com/Azure/acs-engine.git $ cd acs-engine $ sudo ./scripts/devenv.sh

Once the bootstrap is complete, build acs-engine as follows:

# make build # # ./bin/acs-engine ACS-Engine deploys and manages Kubernetes, Swarm Mode, and DC/OS clusters in Azure

Usage: acs-engine [command]

Available Commands: deploy deploy an Azure Resource Manager template generate Generate an Azure Resource Manager template help Help about any command orchestrators provide info about supported orchestrators upgrade upgrades an existing Kubernetes cluster version Print the version of ACS-Engine

Flags: --debug enable verbose debug logs -h, --help help for acs-engine

Use "acs-engine [command] --help" for more information about a command.

That’s our prep done. Next, we need to create a template that will generate the deployment templates.

You can find templates that you can use in the examples folder.

Here’s my example that launches a kubernetes cluster within an existing vnet.

Once you have your template ready, you can generate the deployment templates, as follows:

$ ./bin/acs-engine generate examples/kubernetes.json INFO[0000] Generating assets into _output/k8s...

Your deployment templates will be written to a directory with the dnsPrefix used in your template into the _output directory.

Login to Azure and create a resource group to use for your kubernetes cluster:

$ az login $ az group create -n k8s -l westus2

Validate the generated templates:

$ cd _output/k8s $ az group deployment validate -g k8s --template-file azuredeploy.json --parameters @./azuredeploy.parameters.json

Once the template has been validated, deploy as follows:

$ az group deployment create -g k8s --template-file azuredeploy.json --parameters @./azuredeploy.parameters.json

The deployment should take a while. My last one took around 9 minutes.

Once the deployment is complete, copy the kube config from the acs-engine folder to your .kube directory.

$ mkdir ~/.kube $ cp _output/k8s/kubeconfig/kubeconfig.westus2.json ~/.kube/config

Once the config is in place, ensure you have the kubectl binary installed. If you don’t have it installed, you an follow the instructions here to install it.

Once it’s installed, you can get a list of the nodes:

$ kubectl get nodes NAME STATUS ROLES AGE VERSION k8s-master-14054749-0 Ready master 3d v1.8.2 k8s-master-14054749-1 Ready master 3d v1.8.2 k8s-master-14054749-2 Ready master 3d v1.8.2 k8s-workerpool-14054749-0 Ready agent 3d v1.8.2 k8s-workerpool-14054749-1 Ready agent 3d v1.8.2 k8s-workerpool-14054749-2 Ready agent 3d v1.8.2 k8s-workerpool-14054749-3 Ready agent 3d v1.8.2