Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
These are a set of instructions to deploy a Kubernetes cluster to Azure with ACS-Engine. K8s v 1.7 and managed disks
# Commands to deploy Kubernetes cluster with k8s 1.7 and managed disks
# Author: Bruno Medina (@brusmx)
# Requirements:
# - Azure Cli 2.0 (Using 2.0.16)
# - jq (Using 1.5)
# - acs-engine (using release acs-engine-v0.6.0-darwin-amd64 | MD5 checksum(acs-engine-v0.6.0-darwin-amd64/acs-engine) = b124d5ca90dcf5bdd0d9da5699ba776b )
# - managed-disks-cluster.json most be at the same level of this
# Export Azure Service Principal Credentials
# You can use my script to get your credentials
# wget
# You can use
# source
# Or write them by hand here and paste them in your terminal
az login --service-principal -u "${AZURE_CLIENT_NAME}" -p "${AZURE_CLIENT_SECRET}" --tenant "${AZURE_TENANT_ID}"
# Set your environment variables for the cluster (PLEASE CHANGE)
export LOC=southcentralus
export RG_NAME=cluster-mngd-k8s-02
# And lets use the same cluster in the managed disk file you defined.
export RG_DNS_NAME=`cat managed-disks-cluster.json | jq -r ."properties"."masterProfile"."dnsPrefix"`
# Create a Resource Group because its way easier to remove the RG than each thing at a time
az group create --name "${RG_NAME}" --location $LOC
# Create artifacts with acs-engine (Assuming is located in same folder)
./acs-engine generate managed-disks-cluster.json
# You should get a 'INFO[0000] Generating assets...'
# Deploy it
az group deployment create --resource-group="${RG_NAME}" --template-file="_output/${RG_DNS_NAME}/azuredeploy.json" --name="${RG_DNS_NAME}" --parameters @_output/${RG_DNS_NAME}/azuredeploy.parameters.json
#It should take about 10-20 mins
#And after it's done we need the kubeconfig file
# After you have the cluster running
# Get the keys
scp -o StrictHostKeyChecking=no azureuser@$RG_DNS_NAME.$ config-$RG_DNS_NAME
mkdir ~/.kube
#paste this config file into your kube config files and use it's route to make it default
mv config-$RG_DNS_NAME ~/.kube
export KUBECONFIG=~/.kube/config-$RG_DNS_NAME
#Confirm the cluster is up and running by doing
kubectl cluster-INFO
# Get the nodes
kubectl get nodes
#If something went wrong, just delete the resource group and start again
#az group delete -n $RG_NAME
"apiVersion": "vlabs",
"properties": {
"orchestratorProfile": {
"orchestratorType": "Kubernetes",
"orchestratorRelease": "1.7"
"masterProfile": {
"count": 1,
"dnsPrefix": "mngdk8cl02",
"vmSize": "Standard_D2_v2",
"OSDiskSizeGB": 200
"agentPoolProfiles": [
"name": "agent",
"count": 3,
"vmSize": "Standard_DS12_v2",
"OSDiskSizeGB": 200,
"storageProfile" : "ManagedDisks",
"availabilityProfile": "AvailabilitySet"
"linuxProfile": {
"adminUsername": "azureuser",
"ssh": {
"publicKeys": [
"keyData": ""
"servicePrincipalProfile": {
"clientId": "",
"secret": ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment