Table of contents
History of Kubernetes
Online Platform for K8s
Cloud based K8s Service
Kubernetes installation tool
Problems with Scaling up the containers without kubernetes
Features of Kubernetes
Kubernetes vs Docker Swarm
|Installation and cluster configuration||Complicated and time consuming||Fast and Easy|
|Supports||K8s can work with almost all container types like Rocket, Docker containers.||Work with docker only|
|GUI||GUI Available||GUI not available|
|Data Volumes||Only shared with containers in same pod||Can be shared with any other container|
|Updated & Rollback||Process scheduling to maintain services while updating||Progressive updates & service health monitoring throughout the update|
|Autoscaling||Supports vertical and horizontal autoscaling||Not support autoscaling|
|Logging and monitoring||Inbuilt tool present for monitoring||Use 3rd party tools such like splunk|
There's also an another tool - Apache Marathon.
Architecture of Kubernetes
A cluster is all of the above components put together as a single unit.
We've two main components in Kubernetes architecture-
Working with Kubernetes
The Kubernetes control plane is the main entry point for administrators and users to manage the various nodes. Operations are issued to it either through HTTP calls or connecting to the machine and running command-line scripts. As the name implies, it controls how Kubernetes interacts with your applications.
Components of Control Plane
- Kube API Server
The API server exposes a REST interface to the Kubernetes cluster. All operations against pods, services, and so forth, are executed programmatically by communicating with the endpoints provided by it.
- This API server interacts directly with user(i.e we apply yml or json manifest to kube-apiserver)
- This kube-api server is meant to scale automatically as per load.
- Kube api-server is front-end of control plane.
etcd is a distributed key-value store that Kubernetes uses to share information about the overall state of a cluster. Additionally, nodes can refer to the global configuration data stored there to set themselves up whenever they are regenerated.
- Stores metadata and states of cluster.
- etcd is consistent and high availability store(key-value store)
- Source of touch for cluster state(info about state of cluster)
- etcd has following features:
- Fully replicated: The entire state is available on every node in the cluster
- Secure: Implements automate TLS with optional client-certificate authentication
- Fast: benchmarkes at 10000 writes per second.
The scheduler is responsible for assigning work to the various nodes. It keeps watch over the resource capacity and ensures that a worker node’s performance is within an appropriate threshold.
- When user make request for the creation & management of pods, kube-scheduler is going to take action on these requests.
- Handles POD creation and management.
- Match/assign any node to create and run pods.
- A scheduler watches for newly created Pods that have no node assigned. For every pod that the scheduler discovers, the scheduler becomes responsible for finding best node for that pod to run on.
- Scheduler gets the information for hardware configuration from configuration files and schedules the Pods on node accordingly.
- Controller manager
The controller-manager is responsible for making sure that the shared state of the cluster is operating as expected. More accurately, the controller manager oversees various controllers which respond to events (e.g., if a node goes down).
- make sure actual state of cluster matches to desired state.
- Two possible choices for control manager.
- If k8s on cloud, then it will be cloud controller manager.
- If k8s on non-cloud then it will be kube-controller-manager.
- Node-controller: For checking the cloud provider to determine if a node has been detected in the cloud after it steps responding.
- Rout-controller: Responsible for setting up network, routes on your cloud.
- Service-controller: Responsible for load balancer on your cloud against services of type load balancer.
- Volume controller: For creating, attaching and monitoring volumes and interacting with the cloud provider to orchestrate volume.
### Nodes A Kubernetes node manages and runs pods; it’s the machine (whether virtualized or physical) that performs the given work. Just as pods collect individual containers that operate together, a node collects entire pods that function together. When you’re operating at scale, you want to be able to hand work over to a node whose pods are free to take it. ### Services A service is an abstraction over the pods, and essentially, the only interface the various application consumers interact with. As pods are replaced, their internal names and IPs might change. A service exposes a single machine name or IP address mapped to pods whose underlying names and numbers are unreliable. A service ensures that, to the outside network, everything appears to be unchanged. ### Worker node components
A Kubelet tracks the state of a pod to ensure that all the containers are running. It provides a heartbeat message every few seconds to the control plane. If a replication controller does not receive that message, the node is marked as unhealthy.
- Agent running on the node.
- Listens to kubernetes master.(communicates controller, pod create request)
- Use Port- 10255
- send success/fail report to master.
- Container Engine
- Works with kubelet
- Pulling images
- Start/stop containers
- Exposing containers on ports specified in mainfest.
- Kube proxy
The Kube proxy routes traffic coming into a node from the service. It forwards requests for work to the correct containers.
- assign IP to each pod.
- It is required to assign IP addresses to PODs(dynamic)
- Kube-proxy runs on each node & will get its own unique IP address.
A Kubernetes pod is a group of containers, and is the smallest unit that Kubernetes administers. Pods have a single IP address that is applied to every container within the pod. Containers in a pod share the same resources such as memory and storage. This allows the individual Linux containers inside a pod to be treated collectively as a single application, as if all the containerized processes were running together on the same host in more traditional workloads. It’s quite common to have a pod with only a single container, when the application or service is a single process that needs to run. But when things get more complicated, and multiple processes need to work together using the same shared data volumes for correct operation, multi-container pods ease deployment configuration compared to setting up shared resources between containers on your own.
- Smallest unit in kubernetes.
- POD is a group of one or mroe containers that one deployed together on the same host.
- A cluster is a group of nodes.
- A cluster has atleast one worker node and master node.
- In kubernetes, the control unit is the POD, not containers.
- Consist of one or mroe tightly coupled containers.
- POD runs on node, which is controlled by master.
- Kubernetes only knows about PODS.(does not know aboout individual containers)
- Can't start containers without a POD.
- One POD usually contains one container.
- Share access to memory space.
- connect to each other using localhost.
- Share access to the same volume.
- Containers within pod are deployed in an all-or-nothing manner.
- Entire pod is hsoted on the same node(Scheduler will decide about which node )
Limitations of POD
- No auto-healing or scaling.
- POD crashes.
Higher level kubernetes Objects
- Replication Set:
Scaling and healing
Versioning and Rollback
Static(non-ephemeral) IP and networking
Non ephemeral storage.
For single cloud