Kubernetes 101

Kubernetes 101

Created by Google this open-sourced system helps manage containerized applications within cluster environments. It gives developers a better way to deal with related and distributed components as well as services in infrastructure. After Docker became a hit thanks to its wide use of containers, Kubernetes was added to the Docker community as an additional orchestration engine and it became the biggest name in Cloud Native.

In 2017 Kubernetes officially won the Container Orchestration War beating Mesos, Magnum and Photon, just to name a few. Later that day AWS announced the Elastic Container Service for Kubernetes. Native support was also announced from Pivotal, Docker as well as from Mesosphere.

Kubernetes can be visualized as a system built in layers, with each higher layer abstracting the complexity found in the lower levels. At its base, Kubernetes brings together individual physical or virtual machines into a cluster using a shared network to communicate between each server. This cluster is the physical platform where all Kubernetes components, capabilities, and workloads are configured.

The basics

Kubernetes is a system built from layers bringing together virtual and physical machines connected by a shared network. Each of those servers has its own function. One of them is a master server which handles APIs, therefore, being the brain of operations, communicating with other components and performing scheduling. It is the main point for users and administrators.

A master server has its own components that accept user requests, manage scaling etc. They can be installed on a single machine or across multiple servers. etcd is one of the most fundamental master server components and is used to store configuration data. It can help components to configure and reconfigure while maintaining the cluster state.

Kube-controller-manager manages different controllers and regulates the state of the cluster. It performs routine tasks and can be used in application scaling or endpoint adjusting.

Kube-scheduler assigns workloads for the available nodes by analyzing the current infrastructure environment. It must know the total capacity and the currently available resources. What is more, Kubernetes master is a part of the Kubernetes Control Plane, which maintains the desired state across the cluster.

Nodes

Other machines in the cluster are designated as nodes, which run the workloads and are controlled by Kubernetes master. Kubernetes runs services and applications in clusters to help with flexibility and management. Each node has to have a container runtime that is responsible for starting and managing applications and containers.

Kubelet is an interface for communicating between the Kubernetes master and the node. It retrieves information to end from services as well as communicated with the etcd store.

Kube-proxy is a proxy service managing individual hosts and services availability. It performs simple UDP and TCP stream forwarding.

Kubernetes objects represent the state of all of the entities in the system. It is also an extra layer of abstraction over the container interface. They provide resiliency, scaling and life cycle management features.

Pods

The most basic and the smallest deployable unit that Kubernetes deals with is a pod. It represents one or more containers that are to be controlled by a single application. Pods are managed together as a unit, sharing volumes, environment and life cycle. What is more, they have to always be scheduled on the same node.

A pod template and control parameters are defined by an object called a replication controller. It ensures that the number of pods deployed is equal to the number of pods in its configuration. Replication controllers are starting to be replaced with replication sets, which are more flexible. Replication sets are used by deployments as building blocks. They can be modified by changes in configuration and because of that they are the most commonly used Kubernetes objects.

With pods there are also specialized pod controllers: stateful sets and daemon sets. The former create number-based names for each pod. They perform operations following the numbered identifiers. The latter, return a copy of a pod on each node, which helps during deployment of maintenance pods. Jobs is a workload used by Kubernetes. It ensures a task-based workflow and that running components successfully exit after performing their tasks.

Apart from the above-mentioned Kubernetes components we can also distinguish:

  • services
    • defining a logical set of pods, acting as a basic internal load balancer and grouping logical collections of pods
  • volumes
    • a directory to all containers present in a pod, which allows data sharing
  • and namespaces
    • virtual clusters supported by a physical cluster.

Summary

Kubernetes is a great tool for container orchestration. It allows scaling services, defining and managing applications while preserving high flexibility, reliability and power. It can be integrated with any cloud portfolio like Google Cloud or AWS. Despite being quite daunting at the beginning, Kubernetes is an amazing tool that will leverage the full capabilities of the platform.

Related articles