Thursday, April 25, 2024

An Intro For Beginners: What is Kubernetes & How to Get Started With It

Share

While most modern cloud developers today are familiar with containers, they know these come with their own challenges. Namely, containers are generally inadequate when it comes to managing applications with a large number of containers spread across several hosts. These containers all need managing, and that’s why a container orchestration tool like Kubernetes is effective.

Kubernetes (also known as K8s) is an orchestration engine based on container technology like Docker. In the past few years, Kubernetes has been taking over the DevOps scene since t’s already available on Azure and Google cloud. Read on to learn more about Kubernetes and how to get started with this engine.

Image via Pexels

Kubernetes Defined

While you know it’s an orchestration engine for containers, it’s a lot more powerful than it sounds. It speeds up the entire development process with automated deployments, rolling updates, and app management. Because it can detect and restart services when there’s a crash inside a container, it’s also self-healing. Started by Google in 2014, Kubernetes is an open-source technology with a large community of contributors.

Once you get the hang of it, it’s incredibly easy to use and maintain. Because it’s based on Docker, it’s easy to run any type of application with it. Before you jump in, there are some words you need to understand. Kubernetes has a bit of a language of its own, so here’s a broken-down dictionary:

 

  • Kubectl – This is a CLI tool for Kubernetes
  • Master Node – This is the main entry point for all admin tasks, and it’s the main machine that is in control of all nodes.
  • Worker Node – Alos known as a minion, these are worker machines in Kubernetes. This machine performs all requested tasks which are controlled by the Master Node. They run containers inside pods.
  • Kubelet – A node agent that checks that all containers are healthy and functional.
  • Kubernetes Pod – This pod can host several containers and storage volumes. They’re instances of Deployments. Each Pod has it’s own IP address.

 

These are the basic terms you’ll need to understand to get started. Now that you’ve mastered the basics, let’s talk about how to actually use Kubernetes.

Image via Pexels

Getting Started

The most common way to get started with Kubernetes is with Docker. Once you’ve installed Docker successfully, you’ll need to set up the engine on either Azure or Google Drive. If you’re working with Linux, it might help to have a cheatsheet readily available (source: https://www.loggly.com). For the sake of this guide, we’ll focus on the most common method of using OSX to configure Kubernetes with Azure.

  1. Install – Install Azure-CLI. If needed, make sure Python 3 or later is already installed.
  2. Authorize – Run the command below to load your URL and authentication code:

$ az login

Visit the URL and enter the code. If successful, you’ll see your account information.

  1. Enable Service Providers – Since you’re using Azure, you’ll need to enable Azure Service providers in order to start creating a cluster.

$ az provider register -n Microsoft.Network
$ az provider register -n Microsoft.Storage
$ az provider register -n Microsoft.Compute
$ az provider register -n Microsoft.ContainerService

  1. Resource Group – To create a resource group, give it a name and location with the command below:

$ az group create –name <resource_group_name> –location <location>

  1. AKS Cluster – Create a cluster with a single node:

$ az aks create –resource-group resource_group_name –name cluster_name –node-count 1 –generate-ssh-keys

  1. Connect Cluster – Next, you need to use the Kubernetes CLI tool to pass your cluster’s credentials through kubectl.

$ az aks install-cli
$ az aks get-credentials –resource-group resource_group_name –name cluster_name

That’s the process for creating your first cluster on Azure. As you can see, it’s simple to get started with Kubernetes once you master the basics. Learning this system is a great way to build a scalable stack that can grow with your project. In the next few years, Kubernetes is only expected to grow more popular.

Read more

More News