Exploring Kubernetes: A High Level Overview (Part 1)

A Guide To Getting Started with K8s

Charles Woodruff
4 min readJun 13, 2022

The Basics of K8s

Kubernetes is one of the most popular open-source orchestration tools used to deploy, scale, and manage containerized applications or workloads, ensuring it remains functional, highly available, and resilient. It can be used on-premise or in the cloud, and many cloud vendors provide managed services that take care of the heavy lifting required to maintain complex Kubernetes based infrastructures.

Kubernetes employs a master (control plane) — worker (minion) architecture.

The master node houses components that help maintain the state of the cluster.

  • API Server
    - handles communication with all worker nodes
  • Scheduler
    - responsible for matching Pods (groups of one or more containers) with worker nodes
  • Controller Manager
    - ensures the cluster maintains a desired state
  • Etcd
    - a key value database that stores cluster data

These components can be spread across different machines in order to avoid single points of failure.

The worker (minion) node houses components that launch and maintain containers based on instructions received from the master node.

  • container runtime
    - the engine that starts and manages containers, i.e. Docker, containerd, or CRI-O
  • kubelet agent
    - monitors the state of each Pod
  • kube-proxy
    - maintains network rules and handles network traffic

Kubernetes Workloads

A workload is a rule set that defines how an application runs.

  • Pod
    - one or multiple containers used to run an application or workload
  • ReplicaSet
    - ensures the desired number of Pods is running at all times
  • Deployment
    - declarative statements defining the desired state of Pods and ReplicaSets

Creating A Single Node Cluster

There is no better way to learn a new tool than with hands-on experience. There are several tools that can create a cluster in just a few steps, including Kind, Kubectl, and Minikube.

This document will create a single node cluster using the following:

  • Ubuntu 20.04
  • Docker
  • Minikube
  • kubectl

To install the Docker Engine on Ubuntu, follow the instructions at this link.

If this error is received while trying to start the Docker service,

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.24/version: dial unix /var/run/docker.sock: connect: permission denied 

run the following command to resolve:

sudo chmod 666 /var/run/docker.sock

To install Minikube, follow these commands.

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64sudo install minikube-linux-amd64 /usr/local/bin/minikube

To install kubectl, issue these commands.

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

Starting the Kubernetes Cluster

Run this command to start the minikube cluster.

minikube start

Check the status of each component started by minikube.

minikube status
kubectl get nodes

More detailed information about this node can be displayed by using:

kubectl describe nodes

Start a container using the nginx image, and run kubectl to display details about the pod.

kubectl get pods -o wide

Also note that Docker commands are available to use since this Kubernetes environment uses Docker runtime.

docker ps

Lastly, this cluster can be shutdown by issuing this command.

minikube stop

Where To From Here

The purpose of this document was to provide a 10,000 foot view of Kubernetes and give instructions for setting up a single node cluster environment using just a few steps.

Continue to experience with the kubectl command, and progress by building more complex clusters.

Bookmark this kubectl cheat sheet for future reference.

--

--