ITGOIT - Wiki

Understanding Kubernetes

Kubernetes (often shortened to "k8s") is an open-source container orchestration system for automating the deployment, scaling, and management of containerized applications. It was originally developed by Google and is now maintained by the Cloud Native Computing Foundation (CNCF).

Kubernetes provides a platform-agnostic way to manage and orchestrate containers, which allows developers to deploy their applications on any infrastructure, whether it's on-premise, in the cloud, or in a hybrid environment.

It works by grouping containers into logical units called pods, which can be managed and scaled together. Pods are then organized into logical units called Services, which provide a stable endpoint for accessing the pods.

Kubernetes also provides advanced features such as automatic rollouts and rollbacks, self-healing, and horizontal scaling. It also provides a powerful and flexible API for automating and managing the entire container lifecycle.

Kubernetes is widely used in production environments, it can be run on-premises or in the cloud, it's compatible with many cloud providers such as Amazon Web Services (AWS), Google Cloud Platform (GCP), and Microsoft Azure.

Kubernetes has become a de-facto standard for container orchestration and is widely adopted in the industry for managing containerized workloads. Many companies are using it to deploy and manage their applications, and it's also being used in many enterprise-grade solutions.

The benefits:

The downsides...

Kubernetes architecture

Kubernetes has a modular architecture that consists of several components that work together to provide a powerful and flexible container orchestration system.

components-of-kubernetes.svg

The main components of the Kubernetes architecture include:

It's worth noting that the architecture of Kubernetes is highly extensible and can be customized to suit the needs of different environments and use cases.

Kubernetes objects

Kubernetes is a complex and powerful container orchestration system, and there are several important objects and concepts to be familiar with when working with it. Some of the most important objects to know include:

Pods

A Pod is the smallest and simplest object. It represents a single instance of a running process in the cluster. Pods can contain one or more containers, and all the containers in a pod share the same network namespace and storage. Pods are ephemeral, meaning they can be created, deleted, and scaled dynamically, and they are the atomic unit of scaling and deployment in Kubernetes. Pods are co-located on the same node, have a unique IP address in the cluster, and can communicate with each other using localhost. Pods are accessed by Services, which provide load balancing and service discovery.

Services

A Service is an abstraction layer that defines a set of one or more pods and a policy for accessing them. Services provide load balancing and service discovery, allowing communication between different pods and providing a stable endpoint for pods. Services use a selector to identify the pods it should route traffic to. Services can be exposed inside or outside the cluster using various types of Service such as ClusterIP, NodePort, LoadBalancer or ExternalName. Services can also be used to scale up or down the number of replicas for a Pod and expose the service using DNS for service discovery. Services have virtual IPs that are reachable from within the cluster, can have multiple ports and can be updated without affecting the underlying pods.

Replication Controllers

Replication Controllers (RCs) are a core feature of Kubernetes that ensure that a specified number of replicas of a pod are running at any given time. RCs are responsible for creating, scaling, and deleting pods as necessary to meet the desired replica count. They provide automatic failover by ensuring that if a pod goes down, a new one is created to take its place. RCs use a selector to identify the pods it should manage, and can be used in conjunction with Services to provide load balancing. They also allow for zero-downtime updates and can automatically scale the number of replicas based on resource usage. RCs can also be used to rollback an update if it causes issues. However, it's worth noting that Replication Controllers are a legacy feature and are being replaced by Deployments in Kubernetes. Deployments provide similar functionality as RCs, but with some added benefits such as being able to declaratively update and rollback pods.