Introduction to Kubernetes

Introduction

Kubernetes is an open source platform for managing workloads and services. It facilitates the automation, configuration and deployment of our programs and applications.

It provides us with a container-centric management environment with which to orchestrate compute, networking and storage infrastructure for workloads.

Benefits

The main benefits offered by Kubernetes are the following:

  • Scalability and load balancing

  • Process and application isolation

  • Ease of deployment

  • Automatic resource optimization

  • High availability

  • Deployable in private, public or hybrid clouds.

Architecture

The architecture that Kubernetes follows is as shown in the following diagram:

The following is a description of the various components required to understand and operate Kubernetes:

  • Kube-apiserver: the Kubernetes API server, validates and configures data including pods, services, etc.

  • Kubelet: is the main "agent node" that runs on each node. It allows registering the node with the apiserver.

  • Kube-proxy: it is the network proxy running on each node.

  • Container Runtime: is software that runs containers and manages their images within a node.

In addition, Kubernetes provides a command line interface to execute the instructions for our deployments which is Kubectl. More information on this can be found in the documentation.

Elements

Pods

Pods are the set of one or more containers deployed under a single host. They are the smallest unit that can be defined in Kubernetes.

All containers deployed within the same pod will share storage and network resources with each other.

All pods defined with Kubernetes have a defined lifecycle, which is shown in the following diagram:

Deployments

Deployments add extended support to the software development and deployment lifecycle. Thanks to them we will be able to define the configuration of our pods and replica sets, and which Docker images they will make use of.

Other elements

In addition to pods and deployments, Kubernetes allows you to define and configure the following elements:

  • Replica Set: Keeps a stable set of pod replicas running at all times. Used to guarantee the availability of a container.

  • Services: Works as an internal load balancer, it identifies a group of replicated pods, so it acts as a proxy between the connections it receives and them. All the functionality is internal, it does not offer connection between the external requests and the different containers.

  • ConfigMap: These are configuration files in which the environment variables are defined as key-value pairs so that they can be used in the configuration files of the deployments.

  • Secret: These are configuration files in which data containing sensitive information are defined as key-value pairs. They can be in plain string or Base64 encoded.

  • PVC: Persistent Volume Claim are requests for resources with specific attributes, such as storage spaces.

  • Ingress: They allow incoming connections to internal services to be configured. It allows both http and https connections working as an internal proxy.

Helm

Helm is a tool for Kubernetes deployments that allows you to define, install and update any application.

The main functionality is the deployment of Kubernetes configuration files. In addition to providing greater ease of management and editing, it offers version control of our files.

 

Â