Kubernetes is an open source container management platform designed to run enterprise-class, cloud-enabled and web-scalable IT workloads. It is built upon the foundation laid by Google based on 15 years of experience in running containerized applications.
Though their popularity is a mostly recent trend, the concept of containers has existed for over a decade. Mainstream Unix-based operating systems (OS), such as Solaris, FreeBSD and Linux, had built-in support for containers, but it was Docker which made it available to both the development and IT operations teams. Docker has demonstrated that containerization can drive the scalability and portability of applications. Developers and IT operations are turning to containers for packaging code and dependencies written in a variety of languages. Containers are also playing a crucial role in DevOps processes.
A production applications typically deal with workloads that have many containers running across multiple hosts. The complex architecture dealing with multiple hosts and containers running in production environments demands a new set of management tools. Some of the popular solutions include Docker Datacenter, Kubernetes, and Mesosphere DC/OS.
Container orchestration has influenced traditional Platform as a Service (PaaS) architecture by providing an open and efficient model for packaging, deployment, isolation, service discovery, scaling and rolling upgrades. Most mainstream PaaS solutions have embraced containers, and there are new PaaS implementations that are built on top of container orchestration and management platforms. Customers have the choice of either deploying core container orchestration tools that are more aligned with IT operations, or a PaaS implementation that targets developers.
Like most distributed computing platforms, a Kubernetes cluster consists of at least one master and multiple compute nodes. The master is responsible for exposing the application program interface (API),scheduling the deployments and managing the overall cluster.Each node runs a container runtime, such as Docker or rkt, along with an agent that communicates with the master. The node also runs additional components for logging, monitoring, service discovery and optional add-ons. Nodes are the workhorses of a Kubernetes cluster. They expose compute, networking and storage resources to applications. Nodes can be virtual machines (VMs) in a cloud or bare metal servers in a datacenter.
The above terminologies would be seen with other Container Orchestration engines also like Mesos but what Kubernetes brings in is scalability and availability using pods, relplica sets.
A pod is collection of 1 or more containers. The pod serves as core unit of management. A pod generally represents one or more containers that should be controlled as a single “application”. The intent being that all containers of a single application are deployed on a single host. At runtime pods can be scaled by creating replica sets, which ensure that the deployment always runs minimum or desired number of pods.
Replica sets ensures scalability and availability by ensuring pre-defined set of pods at all times. A single pod or a replica set can be exposed to the internal o external consumers via services. replication controller is a framework for defining pods that are meant to be horizontally scaled. The work unit is, in essence, a nested unit. A template is provided, which is basically a complete pod definition. This is wrapped with additional details about the replication work that should be done.
Replication controller manages the lifecycle of pods. They ensure a specified number of pods are always running. They do this by creating or deleting pods as required hence its recommended that we have a replication controller even if you are creating one pod.Most pods are designed to be long-running, but once the single process dies, the pod dies with it. If it dies, the replication controller replaces it with a new pod. Every pod gets its own dedicated IP address, which allows containers to have the same port, even if they’re sharing the same host. But every time pod is started by the replication controller, the pod gets a new IP address.
Services provide a single stable name and address to a set of pods. They act as basic load balancers.
A service is attached to a replication controller. Each service gets assigned a virtual IP Address, which remains constant. As long as we know the service IP address the service will keep track of pods created/recreated by replication controller and will distribute requests to them.
Labels are used to organize and select groups of objects based on key-value pairs.
They are used by every Kubernetes component. For e.g. the replication controller uses them for service discovery.
The definition of Kubernetes objects like pods, replica sets, services are submitted to master. Based on the defined requirements and availability of resources, the master schedules the pod on a specific node. The node pulls the images from the container image registry and coordinates with the local container runtime to launch the containers.