Kubernetes Quick Guide

Uvindu Dharmawardana
4 min readJul 30, 2019

--

This article will help beginners to get an idea about kubernetes basics and it’s terminology

What is Kubernetes..?

In a simple way kubernetes is a platform which is automating,deploying and managing containers.in order to do that Kubernetes perform below tasks

  • Starting right container at the right time.
  • Make connections between multiple containers.
  • Handling storage management.
  • Take care of failed containers.

Using Kubernetes we can….

  • Run containers across different machines .
  • Scaling up or down or, adding or remove depending on the demand.
  • Keep storage consistent with multiple instances of an application.
  • Distribute load balance between containers.
  • Launch containers in different machines if containers fail.

How Kubernetes works…

Kubernetes works as clusters, a one cluster contains a Node master and child nodes. These nodes are like different different machines. Nodes contain one or more pods. These pods are holding the containers.

Now you can understand that a cluster have,

  • Master node.
  • Child nodes.
  • Pods

Master Node

Cluster is controlled by the Master node. Master node contains,

  • Kube — API server
  • Scheduler
  • Controller Manager
  • Etcd

Developers will be able to communicate with the nodes through the Master node via API server. Each and every node has its own ip address. Users can connect to the containers inside the node via the kube-proxy address.

Kube Master performs several tasks,

  • Authorization and authentication in cluster.
  • Works as RESTful API entry point.
  • Scaling and replicating controllers.
  • Reading the configuration to setup a cluster.

Kube API Server

Kube API server provides HTTP or HTTPS based RESTful API. This API server is the hub of kubernetes components.

Scheduler

Scheduler basically helps to find out which container to run on which node.

Controller — Manager

The controller manager performs cluster operations such as,

  • Manages kubernetes nodes.
  • Creates and updates the kubernetes internal information.
  • Attempts to change the current status to desired status.

Etcd

Kubernetes use etcd to store it’s data, state and metadata.

Nodes(Minion)

Nodes are kind of worker machines in the cluster, These nodes can be VMs or physical machines. Each node contains pods and services which manages the pods. Once you installed Kubernetes, using the command “kubectl get nodes” you can see all the nodes in the cluster.(note that if you are using minikube you can have only one node).

Nodes uses kubernetes API server to communicate with the Master node.

Pods

We already discussed that nodes contains pods. Pods are the higher level structure in kubernetes. Pods contains containers and what they do is wrap all the containers and run them. Using kubectl get pods command you can see all the pods in your node.

Containers in the same pod shares the same resources and the local network.

Pods are the unit of replication in kubernetes. At the production level pods can have multiple copies running this is to prevent pods failures and load balancing.

Pods under same node are scaling up or down as a one unit.

Namespace

You can create virtual clusters in kubernetes. These virtual clusters called “Namespace”.

These Namespaces are very helpful in dividing the cluster resources among several users. In the future Kubernetes is looking to give namespaces their own access control policies.

Persistent Volumes

Persistent volumes are storage which can be mounted to clusters. These PVs have their own life cycle independent on the pod they mounted to.

Deployment

Once you create a cluster you need to deploy the pods in to the cluster, This is where deployment comes to play. You can manage your pods by using the deployment. When user describe a desired state in deployment, the deployment controller changes the current state to the desired state of the pod at a control rate.

When you create your deployment configuration it instructs kubernetes to how to create and update an instance of your application, then master node will deploy an instance of that application in individual nodes in the cluster.

When the application instances are deployed in the nodes, kubernetes deployment controller will monitor those instances for failures.If node get deleted or failed, deployment controller will deploy that instance in another node in the cluster.

Services

Once you have your application deployed in the cluster, external traffic needs to access your application, using services you can allow external traffic to the application.

How services works

When a network call received by the service, it selects all the pods in cluster which are matching to that network call, then service will select one pod and foreword it to the network request.

Service Types

There are three service types in kubernetes.

  • Cluster IP
  • NodePort
  • LoadBalancer

Cluster IP

This service is only accessible within the cluster, Using kubernetes proxy you can enable the access to it.

NodePort

This will enable a static port in each node in the cluster.

LoadBalancer

This service will accessible externally through a cloud providers loadbalancer functionality.

Examples -

  • AWS
  • Azure

--

--

Uvindu Dharmawardana
Uvindu Dharmawardana

Written by Uvindu Dharmawardana

B.Eng Software Engineering University of Westminster

No responses yet