EN

How to create a Managed Kubernetes in 5 minutes with Azure AKS

Why create a managed cluster and how to easily create your lab for testing. (Part 2)

CTO

João Brito

Why Use Kubernetes?

In mid-2024, it is almost certain you have already heard of Kubernetes. If you are just starting out, this article is perfect for you! We will guide you through the first steps with Kubernetes in a simple and straightforward way.

You will learn not only how to set up your own Kubernetes cluster, but also understand the benefits it brings to your projects, along with important tips to avoid common pitfalls.

This is a series of articles covering each of the Cloud Providers. So, don't miss any on our blog.

What are the benefits of using Kubernetes in your environments?

Scalability: Kubernetes simplifies the scalability of your applications, allowing you to easily scale them as your demand grows.

Resilience: With Kubernetes, your applications are highly resilient. It automatically detects and replaces failed containers or nodes, keeping your applications running reliably.

Portability: Kubernetes is an open-source platform and can run in virtually any environment, whether locally, in public, or private clouds. This gives you the flexibility to move your applications between different cloud providers without major modifications.

Automation: With Kubernetes, you can automate application deployment, updates, and scaling tasks, saving time and reducing human error.

Giant Ecosystem: Kubernetes has a vast ecosystem of tools and services, making it easy to integrate with other technologies and accelerating application development.

A Brief History

Here are some of the most important moments in the history of Azure Kubernetes Service (AKS):

  • 2017: Microsoft announces Azure Kubernetes Service (AKS) during the Microsoft Ignite event, offering customers an easy way to deploy, manage, and scale containers using Kubernetes in the Azure cloud.

  • 2018: Azure Kubernetes Service is made generally available (GA), allowing customers to deploy and manage Kubernetes clusters in the Azure cloud.

  • 2019: Azure Arc is announced, allowing customers to manage and govern Kubernetes clusters not only in Azure, but also in multi-cloud and on-premises environments.

  • 2020: Microsoft announces the general availability of Azure Policy for AKS, enabling customers to apply compliance and security policies to their Kubernetes clusters.

  • 2021: Microsoft announces Azure Kubernetes Service Autopilot, a fully managed configuration option that simplifies the operation and scalability of AKS clusters.  

Hands-on

So, this is the time to get this Kubernetes thing up and running.

As this is a very direct and on-point article, we will create a cluster using Azure's native tool, “az”; it can be the simplest alternative to clickops, and I plan to write more about this in the future.

Installing the “az” CLI on Linux (others: here)
curl -L https://aka.ms/InstallAzureCli | bash
Creating a cluster

To avoid creating a cluster with very large machines right away, we will use the option “Standard_DS2_v2”:

Before creating the cluster itself, it is necessary to create some resources, so let's go:

1 - Define your subscription: 

az account set --subscription <subscription_id

2 - Create a resource group:

az group create --name ResourceGroup01 --location eastus

3 - Create the basic cluster:

az aks create --resource-group ResourceGroup01 --name clusterbasico --node-count 2 --node-vm-size Standard_DS2_v2 --generate-ssh-keys


Don't forget to delete this testing cluster

az aks delete --resource-group ResourceGroup01 --name clusterbasico --yes
Banner
Exclusive Benefits

Azure has been in second place in the cloud providers race for a long time and has been creating more and more important and extremely high-quality services every day. Personally, I had some bad experiences with storage back in 2018, but since then we have had a huge evolution, and we have one of the best managed Kubernetes options.

One service I would like to highlight here is Azure Key Vault, which is a great option for a secrets vault to prevent you from putting them directly into your code. Of course, I couldn't fail to mention the identity control service, which when integrated with Key Vault, can bring benefits such as not having to worry about password rotation.

Costs

The AKS service alone has no direct cost, but if you want an SLA in your support with Azure, that does have an average monthly cost of $73. Furthermore, you must take into account the costs of each node or instance, storage costs, networking costs, among others. As this can vary greatly, you can estimate it beforehand in the Azure calculator.

There are some rarely mentioned trade-offs regarding cost optimization where resilience and availability can be compromised. Have a cost-reduction mindset, but understand that the service still has its price; a good tip is this post.

Points of Attention
  • Don't forget to use access control lists (ACL) to securely separate node pools;

  • Use ARM architecture machines which have a lower cost.

  • Always keep a nodepool free of taints; a node is always required for Azure's system pods for reconciliation and upgrading.

  • On average every 2 months new image releases are launched, apply them; it's a matter of security.

Next Steps

Simply having a Kubernetes cluster is not enough. Kubernetes covers a wide range of infrastructure, including networking, storage, computing, and more. This results in a massive cognitive load and makes it almost impossible to master all the necessary details, especially since we get a new version every 4 months. Your cloud-native journey with Kubernetes is just beginning, and you will certainly come across an entire ecosystem of tools, such as monitoring, centralized logging, CI/CD, and, of course, your own applications.

So don't miss our next content here on the blog, and also follow Kubicast, where you can hear about experiences, use cases, and learn a lot about the cloud-native world.

Until next time with a new cloud provider!

Newsletter Getup.

Atualizações sobre Kubernetes e Software Supply Chain Security todos os meses.

Operating Kubernetes in production for more than 13 years. With Quor, this experience extends to software supply chain security as well.