Journey into Kubernetes - Azure: Start

·

4 min read

Azure CLI

First things first. Before starting this whole process, we need some tools. You'll be interacting with Azure via their CLI, so if you don't have it yet, grab it here. You also need a text editor. I'm partial to VS Code. The Docker extension may also be helpful, but I didn't use any plugins at all. Seems the VS Code comes with YAML support out of the box.

Now that you have the CLI and a text editor, let's get started!

Let's check to make sure your Azure CLI is at least version 2.0.

az --version | select -First 1

The result should be > 2.0. As of this writing, it's 2.3.1!

azure-cli                2.3.1

To interact with Azure, you must log in.

az login

This will pop up a browser window and ask you to log into your Azure account. After you log in, you'll get a message that you logged in successfully! Now is a good time to go over some basic Azure CLI commands. I am by no means an expert here, but I'll share what has made my life easier

You can always add --help at the end of any command. This will print out a wealth of information about the command you're asking help about. Examples:

az --help
az account --help
az aks --help

Most output from commands you execute will come in JSON format. Usually that's fine if you have one or two results, but later if you have large lists of items coming back at you, you'll need to format the output differently. You can do this with the -o flag. Examples:

az account show -o table
az vm list -o tsv

The last useful flag I found was --query which will pull out a value from a result set. This is useful if you're looking for something in a large result set. Example:

az account show --query user.name

Above command should give you the e-mail address with which you're logged in. Think of it as a 'grep' for CLI output without the terrible grep syntax.

This quick overview of Azure CLI should suffice. Let's move onto ACR.

Azure Container Service

For this series of articles, I'm going to assume you already have a container registry setup on Azure. If you do not, here's a quick command to set one up (replace the stupid RG and Registry names with your own):

az acr create -g CoolResourceGroup -n CoolContainerRegistry --sku Basic

Again, please remember that you can always type in az acr create --help to get a full list of parameters you can use. For example, you can use 4 different values for the --sku flag: Basic, Classic, Premium, Standard. You can also do this on Azure Portal!

(Optional) Log into ACR

If you just created the registry, you'll want to push some Docker containers up to it. That's out of scope of this article series. However, before you push any containers, you'll need to log into the Container Registry:

az acr login -n CoolContainerRegistry

Note: You need to have Docker installed on your system to interact with the registry! To push containers to the registry, once logged in, you will use Docker commands such as docker push or docker tag. ACR is really just a Docker registry with some Azure fluff.

If you do not need to interact with the registry via Docker commands, you don't need to log in. For the purpose of this series, we're not really interacting with the container registry much and I'll assume you know how to push images to it.

Assuming you have a repository set up and some containers uploaded, you can view the list of containers using this command:

az acr repository list -n CoolContainerRegistry

We'll leave it here for now. In the next article we'll set up a Service Principal which we will then use to spin up our K8s cluster and give it read access to our container registry.


Resources:

Did you find this article valuable?

Support Paul K by becoming a sponsor. Any amount is appreciated!