kubernetes

AKS (Azure Kubernetes Service) through azure cli

You can deploy AKS using the azure-cli. Here is a quick tutorial on how to do it!

First off, ensure you have the azure-cli installed on your machine. If you have a mac it’s pretty simple. You can just do:

brew install azure-cli

If you are using Windows or Linux then follow the instructions on the Microsoft page.

Login to you Azure account using:

az login

Now we are going to create some variables for location, resource and cluster that we will use to set up our Kubernetes cluster:

export LOCATION=uksouth
export RESOURCE_GROUP=aks-project-group
export CLUSTER_NAME=josiemundi-cluster

Now we create a resource group for our cluster:

az group create --name $RESOURCE_GROUP --location $LOCATION

Now lets deploy our cluster:

az aks create --resource-group $RESOURCE_GROUP \
--name $CLUSTER_NAME \
--generate-ssh-keys \
--node-vm-size Standard_DS2_v2

You can actually head over to your Azure portal and within the resource group we set up, you should now see Kubernetes service. If you click on it, you will see it is in the process of deploying (or maybe already has).

We now need to link with our azure account

az aks get-credentials --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME --admin

Now we can see our deployment with the following command:

kubectl get nodes

Here is a link to a list of the cli commands available for aks.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s