Table of contents
What is Kubernetes
Kubernetes, also known as K8s, is an open-source system for automating the deployment, scaling, and management of containerized applications. Google originally designed Kubernetes, but the Cloud Native Computing Foundation now maintains the project. Let's get a better understanding with an example; Suppose you are trying to build a company. You need multiple departments to run the company: CFO, call centre, engineering team, marketing, sales, etc. Think of them as different kinds of containers. Kubernetes has a file which has the description of all the containers and how they work together (sales work with marketing; marketing works with engineering and this is how everybody talks to each other). When you tell Kubernetes to execute, it ‘hires’ all containers and if any one of them fails: it restarts it and redoes it.
That's a simple explanation of what Kubernetes does.
Advantages
- Kubernetes does load balancing when there is too much traffic.
- Kubernetes helps you do some storage with a disc.
- Kubernetes eliminates many of the manual processes involved in deploying and scaling containerized applications and standardizes them.
- Kubernetes orchestration allows you to build application services that span multiple containers, schedule containers across a cluster, scale those containers, and manage their health over time.
- Kubernetes High-Availability is another benefit because if something fails, it will replace it and restart.
Why was it needed:
Container orchestration is what makes that operational complexity manageable for development and operations—or DevOps—because it provides a declarative way of automating much of the work. This makes it a good fit for DevOps teams and culture, which typically strive to operate with much greater speed and agility than traditional software teams.
This is what Kubernetes does, but much better:
- Better management through modularity
- Deploying and updating software at scale
- Laying the foundation for cloud-native apps
K8s Terminologies
- Node: They are composed of physical or virtual machines on your cluster; these “worker” machines have everything necessary to run your application containers.
- Pod: The smallest object of the Kubernetes ecosystem, a pod represents a group of one or more containers running together on your cluster.
- Cluster: A group of nodes that run containerised applications. The cluster, and everything within it, is managed with Kubernetes. A cluster is made up of a master node and a set of worker nodes.
On each node you will find three things:
- Kubelet: Kubelets are an essential part of a Kubernetes cluster. Part of each node in the cluster, Kubelets make sure containers are actually running in a pod via the Kubernetes API server. They're also responsible for registering a node within a cluster and reporting on resource utilization.
- Kube-proxy: A network proxy that runs on each node in your cluster, maintaining network rules on nodes, which allows for network communication to your pods. In other words, it is an intelligent forwarding logic, to ensure low overhead.
- Container runtime: A low-level component of a container engine that mounts the container and works with the OS kernel to start and support the containerization process. It is also known as cAdvisor. An example would be Docker.
=> Managing processes are done by the master node which runs 4 processes:
Kubernetes API server: the API server is the gateway to the Kubernetes cluster. It is the central touch point that is accessed by all users, automation, and components in the Kubernetes cluster.
Kube-scheduler: The default scheduler for Kubernetes, kube-scheduler is in charge of scheduling pods onto nodes.
Kube-controller-manager: Detects the dead nodes and tries to recover the cluster state asap. It communicates with the scheduler to do so.
Etcd: An open-source distributed key-value store which stores and manages the configuration data, state data and metadata for Kubernetes.
- Deployment: A deployment is an object that manages a replicated application, making sure to automatically replace any instances that fail or become unresponsive. Deployments help make sure that one (or more) instance of your application is available to serve user requests.
- Kubectl: A command line tool for communicating with a Kubernetes API server, used to create and manage Kubernetes objects.
- Service: An abstraction which defines a set of pods and makes sure that network traffic can be directed to the pods for the workload.
- Namespace: A virtual cluster where you can provision resources and provide scope for pods, services and deployments. They provide a scope for unique naming in order to divide cluster resources in an environment when there are several teams and/or projects.
- Ingress: An API object that allows external access (aka outside the Kubernetes cluster) to your application.
- Config map: A ConfigMap is an API object used to store non-confidential data in key-value pairs. ConfigMap does not provide secrecy or encryption.
- Volumes: A Volume in Kubernetes represents a directory with data that is accessible across multiple containers in a Pod. The container data in a Pod is deleted or lost when a container crashes or restarts, but when you use a volume, the new container can pick up the data at the state before the container crashes. The volume outlives the containers in a Pod and can be consumed by any number of containers within that Pod.
That’s it for Part 1 of this blog. Stay tuned for Part 2 where we go through some basic commands and their working. Au revoir!!