What's on this Page
This guide will help to understand basics concepts of Kubernetes.
What is Kubernetes?
Kubernetes (commonly referred to as “k8s”) is an open source container cluster manager originally designed by Google and donated to the Cloud Native Computing Foundation. It aims to provide a “platform for automating deployment, scaling, and operations of application containers across clusters of hosts”. It usually works with the Docker container tool and coordinates between a wide cluster of hosts running Docker.
With Kubernetes, you are able to quickly and efficiently respond to customer demand:
- Deploy your applications quickly and predictably.
- Scale your applications on the fly.
- Seamlessly roll out new features.
- Optimize use of your hardware by using only the resources you need
- portable : public, private, hybrid, multi-cloud
- extensible : modular, pluggable, hookable, composable
- self-healing : auto-placement, auto-restart, auto-replication, auto-scaling
Cluster : A cluster is a set of physical or virtual machines and other infrastructure resources used by Kubernetes to run your applications.
Node : A node is a physical or virtual machine running Kubernetes, onto which pods can be scheduled.
Pod : A pod is a co-located group of containers and volumes. Kubernetes targets the management of elastic applications that consist of multiple microservices communicating with each other. Often those microservices are tightly coupled forming a group of containers that would typically, in a non-containerized setup run together on one server. This group, the smallest unit that can be scheduled to be deployed through K8s is called a pod. This group of containers would share storage, Linux namespaces, cgroups, IP addresses. These are co-located, hence share resources and are always scheduled together. Pods are not intended to live long. They are created, destroyed and re-created on demand, based on the state of the server and the service itself.
Label : A label is a key/value pair that is attached to a resource, such as a pod, to convey a user-defined identifying attribute. Labels can be used to organize and to select subsets of resources.
Selector : A selector is an expression that matches labels in order to identify related resources, such as which pods are targeted by a load-balanced service.
Replication Controller : A replication controller ensures that a specified number of pod replicas are running at any one time. It both allows for easy scaling of replicated systems and handles re-creation of a pod when the machine it is on reboots or otherwise fails.
Service : As pods have short lifetime, there is not guarantee about the IP address they are served on. This could make the communication of microservices hard. Imagine a typical Frontend communication with Backend services. Hence K8s has introduced the concept of service, which is an abstraction on top of number of pods, typically requiring to run a proxy on top, for other services to communicate with it via a Virtual IP address. This is where you can configure load balancing for your numerous pods and expose them via a service.
Volume : A volume is a directory, possibly with some data in it, which is accessible to a Container as part of its filesystem. Kubernetes volumes build upon Docker Volumes, adding provisioning of the volume directory and/or device.
Secret : A secret stores sensitive data, such as authentication tokens, which can be made available to containers upon request.
Name : A user- or client-provided name for a resource.
Namespace : A namespace is like a prefix to the name of a resource. Namespaces help different projects, teams, or customers to share a cluster, such as by preventing name collisions between unrelated teams.
Annotation : A key/value pair that can hold larger (compared to a label), and possibly not human-readable, data, intended to store non-identifying auxiliary data, especially data manipulated by tools and system extensions. Efficient filtering by annotation values is not supported.
Networking : flannel is a virtual network that gives a subnet to each host for use with container runtimes. read more about this on https://github.com/coreos/flannel
Master node is responsible for the management of Kubernetes cluster. This is the entry point of all administrative tasks. Master node is the one taking care of orchestrating the worker nodes, where the actual services are running.
Inside Master Node
API server : API server is the entry points for all the REST commands used to control the cluster. It processes the rest requests, validates them, executes the bound business logic. The result state has to be persisted somewhere, and that brings us to the next component of the master node.
etcd storage : etcd is a simple, distributed, consistent key-value store. It’s mainly used for shared configuration and service discovery. It provides a REST API for CRUD operations as well as an interface to register watchers on specific nodes, which enables a reliable way to notify the rest of the cluster about configuration changes. Example of data stored by Kubernetes in etcd are jobs being scheduled, created and deployed pod/service details and state, namespaces and replication informations, etc
scheduler : The deployment of configured pods and services onto the nodes happens thanks to the scheduler component. Scheduler has the information regarding resources available on the members of the cluster, as well as the ones required for the configured service to run and hence is able to decide where to deploy a specific service.
controller-manager : Optionally you can run different kinds of controllers inside the master node. controller-manager is a daemon embedding those. A controller uses apiserver to watch the shared state of the cluster and makes corrective changes to the current state to being it to the desired one. An example of such a controller is the Replication controller, which takes care of the number of pods in the system. The replication factor is configured by the user and that’s the controller’s responsibility to recreate a failed pod, or remove an extra-scheduled one. Other examples of controllers are endpoints controller, namespace controller, and serviceaccounts controller
Flannel - A network overlay that will allow containers to communicate across multiple hosts.
The pods are run here, so the worker node contains all the necessary services to manage the networking between the containers, communicate with the master node, and assign resources to the containers scheduled.
Inside Worker node
Docker : Docker runs on each of the worker nodes, and runs the configured pods. It takes care of downloading the images and starting the containers.
kublet : kubelet gets the configuration of a pod from the apiserver and ensures that the described containers are up and running. This is the worker service that’s responsible for communicating with master ndoe. It also communicates with etcd, to get information about services and write the details about newly created ones.
kube-proxy : kube-proxy acts as a network proxy and a load balancer for a service on a single worker node. It takes care of the network routing for TCP and UDP packets.
kubectl : And final bit – a command line tool to communicate with API service and send commands to the master node.
Flannel : A network overlay that will allow containers to communicate across multiple hosts.
This is obviously a very simplistic description. If you wish to dig deeper, just read the official documentation on http://kubernetes.io