Weekly blog part 3 – HPCC System Intern

Connecting the dots, and now what?

With enough conceptual introduction, let’s visualize our understanding by building a simple example. In order to do so, there is going to be two part exercise. First, environmental setup for tools such as Helm, Kubernetes, and Terraform is necessary. Once the environmental setup is done, there comes the fun coding part. First this post covers Kubernetes creation of pods and clusters with kind and monitoring with Docker Desktop.

Create a designated folder

In order to organize this exercise as much as possible, let’s start from creating a folder called First-Terraform in your desktop. This folder will contain files we create for the walk throughs. Open up your terminal and go to the folder you just created.

Before we fully begin

This posts assume that you have following already installed locally on your computer: Terraform, Helm, and Kind.

If not, resources below guides you through an installation of resources we need.

Starting locally with Kind

Kind is a tool for running Kubernetes clusters locally. However, Docker Desktop needs to be running in the background. According to the documentation, “kind runs Kubernetes clusters by using Docker containers as ‘nodes’” So the Docker first needs to be running in order to create a kind cluster.

Once the Docker desktop is running, the command to create kind cluster is:

kind create cluster

this command create a single kind cluster with default name, ‘kind’

Creating a tutorial cluster with following command:

kind create cluster --name="tutorial-1"

--name argument enables creation of cluster with specified name. In order to check if the node has been correctly created, we can run:

kubectl get nodes

This command shows a list of existing nodes that is running locally.

Creating kind cluster with .yaml config file

Specifying every details about the cluster created on command line is a daunting and error prone task. YAML configure file with declarative syntax allows us to create a cluster with desired characteristics.

  1. Create a .yaml file with touch config.yaml . YAML is a human readable data serialization language used for writing configuration file (Red hat).
  2. Open config.yaml, with nano config.yaml.
  3. Write the configuration as follows to create a cluster named tutorial-1 with one control plane nodes, and two worker nodes.
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: tutorial-1
nodes: 
- role: control-plane
- role: worker
- role: worker

Other than designating roles to nodes, you can specify internet protocol versions, ports to be exposed and more.

Two worker nodes hosts pods to run containerized applications while a control-plane manages the worker nodes and monitor the cluster.

What is next?

Now we have warmed up to creating kind cluster, we would like to go into Terraform and creating cluster, manage them, and observe how we can use helm, Kubernetes and terraform altogether.

Reference


Leave a comment

Design a site like this with WordPress.com
Get started