This repository contains code that will get a Kubernetes cluster running on Azure using acs-engine and Azure cli with the fewest amount of changes. The target audience is developers that are unfamiliar with acs-engine.
The generated cluster is fit only for non production i.e. development and testing use.
- acs-engine: Download and install.
- Azure cli: Download and install.
- kubectl: Download and install.
- jq: Download and install
- (Optional) A provisioned Azure Active Directory service principal: Create using Azure portal or Create using Azure CLI
Using acs-engine to create a Kubernetes cluster on Azure bascially involves the following steps.
- Customize the cluster that will be created up modifying the cluster definition json file.
- Invoke acs-engine to generate the ARM templates for your cluster.
- Deploy the generated ARM template.
- Update
createCluster-1.sh
and set values for the following variables:SUBSCRIPTION_ID
,RESOURCE_GROUP
,LOCATION
andDNS_PREFIX
. - Run the script
createCluster-1.sh
.
The script does the following:
- Creates a new resource group.
- Creates a new service principal and:
- Gives it contributor permissions to the resource group created above.
- Updates
serviceProfile
section inclusterDefinition.json
with the appID and secret.
- Creates a pair of SSH keys and:
- Updates the
key-data
property inclusterDefinition.json
with the public key.
- Updates the
- Updates the
dnsPrefix
property inclusterDefinition.json
. - Writes the new cluster definition to
clusterDefinition-3.json
- Invokes acs-engine to generate the ARM templates for creating the cluster.
- Deploys the generated ARM templates to Azure. This steps takes a while to complete.
- Downloads the kube config file by connecting to the master node using SSH. This step might require you to enter the password for the private SSH key.
- Connects to the newly created Kubernetes cluster using the downloaded configuration information and prints the cluster information.
Note that this option uses a password that is checked into the repository and is therefore publically available. The cluster created by this file should not be considered secure
- Create/place a set of SSH keys in the root folder. The keys should be named
acsEngine_rsa
andacsEngine_rsa.pub
. - Update
createCluster-2.sh
and set values for the following variables:SUBSCRIPTION_ID
,RESOURCE_GROUP
,LOCATION
andDNS_PREFIX
. - Run the script
createCluster-2.sh
.
The script does the following:
- Creates a new resource group.
- Creates a new service principal and:
- Gives it contributor permissions to the resource group created above.
- Updates
serviceProfile
section inclusterDefinition.json
with the appID and secret.
- Updates the
key-data
property inclusterDefinition.json
with the public key. - Updates the
dnsPrefix
property inclusterDefinition.json
. - Writes the new cluster definition to
clusterDefinition-2.json
- Invokes acs-engine to generate the ARM templates for creating the cluster.
- Deploys the generated ARM templates to Azure. This steps takes a while to complete.
- Downloads the kube config file by connecting to the master node using SSH. This step might require you to enter the password for the private SSH key.
- Connects to the newly created Kubernetes cluster using the downloaded configuration information and prints the cluster information.
- Create/place a set of SSH keys in the root folder. The keys should be named
acsEngine_rsa
andacsEngine_rsa.pub
- Update
createCluster-3.sh
and set values for the following variables:SERVICE_PRINCIPAL_ID
,SERVICE_PRINCIPAL_PASSWORD
,SUBSCRIPTION_ID
,RESOURCE_GROUP
,LOCATION
andDNS_PREFIX
. - Run the script
createCluster-3.sh
.
The script does the following:
- Creates a new resource group.
- Gives the service princiapl contributor permissions to the resource group created above.
- Updates
serviceProfile
section inclusterDefinition.json
with the appID and secret.
- Updates
- Updates the
key-data
property inclusterDefinition.json
with the public key. - Updates the
dnsPrefix
property inclusterDefinition.json
. - Writes the new cluster definition to
clusterDefinition-3.json
- Invokes acs-engine to generate the ARM templates for creating the cluster.
- Deploys the generated ARM templates to Azure. This steps takes a while to complete.
- Downloads the kube config file by connecting to the master node using SSH. This step might require you to enter the password for the private SSH key.
- Connects to the newly created Kubernetes cluster using the downloaded configuration information and prints the cluster information.
This repository contains code that is based on the work of Wes yao, Aaron Schnieder and Ivan Shaporov