What is Kubernetes?
Kubernetes is an orchestration engine and open-source platform for managing containerized applications. kubernetes include container deployment, scaling & descaling of containers
First google company was introduced kubernetes for their deployment prospective later they Donated kubernetes to CNCF (Cloud native computing foundation) in 2014.Kubernetes v1.0 was released on July 21, 2015.
Features of Kubernetes:
1.) Automated Scheduling: K8s provides advanced scheduler to launch container on cluster nodes based on their resource requirements and other constraints, while not sacrificing availability.
2.) Self Healing Capabilities: K8s allows to replaces and reschedules containers when nodes die. It also kills containers that don’t respond to user-defined health check and doesn’t advertise them to clients until they are ready to serve.
3.) Automated rollouts & rollback: K8s rolls out changes to the application or its configuration while monitoring application health to ensure it doesn’t kill all your instances at the same time. If something goes wrong, with Kubernetes you can rollback the change.
4.) Horizontal Scaling & Load Balancing: K8s can scale up and scale down the application as per the requirements with a simple command, using a UI, or automatically based on CPU usage
5.) Service Discovery & Load balancing: There is not necessary to bother about networking and information because the K8s order automatically assigns IP addresses to containers also a single DNS name for the collection of containers, which can load-balance traffic inside the cluster.
6.) Storage Orchestration: With K8s, you can mount the storage system of your choice. You can either opt for local storage, or choose a public cloud provider such as GCP or AWS, oracle cloud platform or perhaps use a shared network storage system such as NFS, iSCSI, etc
Kubernetes implements a cluster computing background, everything works from inside a Kubernetes Cluster. This cluster is hosted by one node acting as the ‘master’ of the cluster, and other nodes as ‘nodes’ which do the actual ‘containerization‘. Below is a diagram showing the same
Web UI (Dashboard)
Dashboard is a web-based Kubernetes user interface. You can use Dashboard to deploy containerized applications to a Kubernetes cluster, troubleshoot your containerized application, and manage the cluster itself along with its available resources.
Kubectl to deploy applications, inspect and manage cluster resources, It is a command line configuration tool (CLI) for Kubernetes used to interact with master node of kubernetes. contains kube-config file This file has the information about server and authentication information to access the API Server.
The master node is responsible for the management of Kubernetes cluster. It is mainly the entry point for all administrative tasks. It handles the orchestration of the worker nodes.
Master Components It has below components that take care of communication, scheduling and controllers.
Kube API Server interacts with API, Its a frontend of the kubernetes control plane. Communication center for developers, sysadmin and other Kubernetes components
Scheduler watches the pods and assigns the pods to run on specific hosts
Controller manager runs the controllers in background which runs different tasks in Kubernetes cluster. Performs cluster-level functions (replication, keeping track of worker nodes, handling nodes failures…).
Some of the controllers are,
1. Node controller – Node controller is responsible for noticing and responding when nodes are down.
2. Replication controllers – It maintains the number of pods. It controls how many identical copies of a pod should be running .
3. Endpoint controllers– services and pods together.
4. Replicaset controllers- Replicaset controllers ensure number of replication of pods running at all time.
5. Deployment controller – It provides declarative updates for pods and replicasets.
6. Daemonsets controller- It ensure all nodes run a copy of specific pods.
7. Jobs Controller– pods carrying out batch jobs
etcd is a simple distribute key value store. It uses etcd as its database to store all cluster datas. some of the data stored in etcd is job scheduling information, pods, state information and etc.
Worker nodes are the nodes where the application running in cluster, known as minion. These each worker nodes are controlled by the master node using kubelet process.
Container Platform must be running on each worker nodes and it works together
kubelet to run the containers, This is why we use Docker engine and takes care of managing images and containers.
Kubelet is the primary node agent runs on each nodes and reads the container manifests which ensures that containers are running and healthy. It makes sure that containers are running in a pod. The kubelet doesn’t manage containers which were not created by K8s.
Kube-porxy Kubernetes service abstraction by maintaining network rules on the host and performing connection
• It helps us to have network proxy and load balancer for the services in a single worker node. Worker nodes can be exposed to internet via kubeproxy.
Kubernetes Objects are persistent entities in the Kubernetes system. K8S uses these entities to represent the state of your cluster.A Kubernetes object is a “record of intent”–once you create the object, the Kubernetes system will constantly work to ensure .work with It objects–whether to create, modify, or delete them–you’ll need to use the API.
The basic Kubernetes objects include:
• Pod, Replication Controller, ReplicaSet, DaemonSet, Deployment, Services, Volume
Namespace is a Cluster inside kubernetes cluster. You can have multiple namespaces inside a single cluster, and they are all logically isolated from each other. They can help you and your teams with organization, security, and even performance The first three namespaces created in a cluster are always default, kube-system, and kube-public.
Default– for deployments that are not given a namespace, which is a quick way to create a mess that will be hard to clean up if you
do too many deployments without the proper information.
Kube-system– all things relating to the K8s system. Any deployments to this namespace are playing a dangerous game and
can accidentally cause irreparable damage to the system itself.
Kube-public– It is visible everyone,namespace is reserved for system usage.
Using namespaces for isolation
• I have used namespaces for isolation in a couple of ways. I use them most often to split many users’ projects into separate environments.
• kubectl get namespace
• kubectl create namespace test