FY18P20Labs

View the Project on GitHub

Containers Orchestrator hands-on lab with Kubernetes

Kubernetes Installation on Azure

Note: A number of resources created in this demo have names that must be globally unique (e.g. ACR endpoints). In those cases the commands will include a placeholder value noted within angle brackets <> to signal that a value specific to your environment needs to be provided.

Outline

  1. Download and install Azure CLI
  2. Logging in to your Azure subscription
  3. Create the Kubernetes cluster
  4. Install Kubectl command line
  5. Download the K8s cluster configuration
  6. Test your Kubernetes installation

Details

The following steps will create the Kubernetes cluster using command line commands:

Download and install Azure CLI

If you don’t have it installed locally, follow the guide here to install Azure CLI v2 on your local machine.

Login to your Azure subscription and create a new resource group

NOTE: For simplicity’s sake, we will use the same name for the Resource Group and the DNS Prefix. To prevent DNS name collisions, make sure to suffix RESOURCE_GROUP with your username. e.g. RESOURCE_GROUP=my-k8s-cluster-thfalgou

RESOURCE_GROUP=my-k8s-cluster-<USER>
az group create --name $RESOURCE_GROUP --location southcentralus

Create the Kubernetes cluster

az acs create --name $RESOURCE_GROUP --resource-group $RESOURCE_GROUP --orchestrator-type Kubernetes --dns-prefix $RESOURCE_GROUP --generate-ssh-keys

The above command will use ACS to create a new Kubernetes cluster named “my-k8-cluster” within the newly created resource group. The orchestrator-type parameter indicates to ACS that you are creating a kubernetes cluster with a dns parameter and to generate new ssh keys and service principals.

Install Kubectl command line.

If not already installed, you can use the cli to install the k8 command line utility (kubectl).

Note: On Windows you need to have opened the command windows with Administrator rights as the installation tries write the program to “C:\Program Files\kubectl.exe”. You may also have to add “C:\Program Files” to your PATH

az acs kubernetes install-cli

Download the k8s cluster configuration (including credentials):

The kubectl application requires configuration data which includes the cluster endpoint and credentails. The credentails are created on the cluster admin server during installation and can be downloaded to your machine using the get-credential subcommand.

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

Test your Kubernetes Installation:

After downloading the cluster configuration you should be able to connect to the cluster using kubectl. For example the cluster-info command will show details about your cluster.

kubectl cluster-info

Lab Navigation

  1. Lab Overview
  2. Kubernetes Installation on Azure <– You are here
  3. Hello-world on Kubernetes
  4. Experimenting with Kubernetes Features
    1. Placement
    2. Reconciliation
    3. Rolling Updates
  5. Deploying a Pod and Service from a public repository
  6. Create Azure Container Service Repository (ACR)
  7. Enable OMS monitoring of containers
  8. Create and deploy into Kubernetes Namspaces

Back to Index