Kubernates-Part1
Kubernates-Part1
Kubernates
Agenda
● Introduction
Kubernates
● Architecture
Instructions / Notes
● K8 cluster installation ● Starts: 30 May, 7:30am PDT/PST or 30 May, 8pm IST
● Minikube ● 2 Hours session with 10 minutes Break
Kubernates
Kubernetes
The open source project is hosted by the Cloud Native Computing Foundation (CNCF).
Kubernates
Kubernates : Product features
containers
● Service discovery and load balancing: It can expose a container using the
DNS name or using their own IP address. it can load balance and distribute
Kubernates
Kubernates : Product features
● Automated rollouts and rollbacks: It constantly monitors pods health and
rollout or rollback deployments to maintain desired state
Kubernates
Kubernates: Popularity
Kubernetes' functionality can be extended Deployment :
1. Local
i. custom resources,
2. Remote
ii. operators,
3. Virtual Machine
iii. custom APIs, 4. Bare metal
iv. scheduling rules or plugins. 5. public cloud
6. private cloud
7. hybrid
8. multi-cloud setups
9. Offered as Managed service by
various cloud providers like
a. AWS
b. Azure
Kubernates
Kubernates
K8s is used for workload management in online retail, ridesharing, telecommunications,
banking, education, finance and investments, gaming, information technology, media and
streaming and many other industries. Below are few case study on the Kubernetes website:
○ BlaBlaCar
○ BlackRock
○ Huawei
○ Box
○ IBM
○ eBay
○ ING
○ Haufe Group
○ Nokia
○ Wikimedia
○ Pearson
○ And many more.
Kubernates
Cloud Native Computing Foundation
The Cloud Native Computing Foundation (CNCF) is one of the projects hosted by the Linux
Foundation.
SPIFFE :Secure Production Identity gRPC: open source universal RPC Kubernetes for container orchestration
Framework for Everyone framework Prometheus for monitoring
Brigade :Event-driven scripting CNI :Container Network Interface - Envoy for service mesh
Network service mesh (NSM) networking for Linux containers CoreDNS for service discovery
OpenTelemetry:portable telemetry a
built-in feature of cloud-native software
Kubernates
Kubernetes Architecture
Kubernates
Kubernates Jargon
● Cluster :Group of Machine working in coordination to host multiple container
○ Node controller
○ Replication controller
○ Endpoints controller
● kube-api-server : REST interface of control plane for user and service account
Kubernates
Kubernates Jargon
● etcd : key value distributed data store based on Raft Consensus Algorithm
Kubernates
Kubernetes Components
Kubernates
K8s cluster
● Add ons
○ DNS : Servers DNS records for services hosted in k8s cluster
○ UI: General purpose web UI dashboard
○ CNI : network overlay for pod communication
Kubernates
Master Node
● Runs control plane components
○ kube-apiserver
○ etcd
○ kube-scheduler
○ kube-controller-manager
○ cloud-controller-manager
● Receive request for Kube - API servers in control plane
○ API - Application programing interface
○ CLI - Command Line interface
○ UI Dashboard
● Loss of master node can result is downtime
● Host etcd if etcd is not hosted on external node
● If is recommended to have at least 3 master node for High availability
● Cluster configuration data is stored in etcd.
Kubernates
API Server
○ Administrative tasks are coordinated by the kube-apiserver,
○ The API server processes RESTful calls from users, operators and external agents, then
validates
○ API server reads cluster's current state from the etcd, and writes the resulting state of
the Kubernetes cluster is saved in etcd
○ The API server is the only master plane component to talk to the etcd data store,
○ It act as a middle-man interface for any other control plane agent requiring to access
the cluster's data store.
○ The API server is highly configurable and customizable. It also supports the addition of
custom API servers, when the primary API server becomes a proxy to all secondary
custom API servers and routes all incoming RESTful calls to them based on custom
defined rules.
Kubernates
Scheduler
○ A scheduler is extremely important and quite complex in a multi-node
Kubernetes cluster.
○ kube-scheduler assigns pods and objects to nodes.
○ scheduling decisions are made based on current Kubernetes cluster state and
new object's requirements.
○ The scheduler implement bin packing feature by collecting worker node
resource usage data from etcd and object requirement through API server
○ Requirements may include constraints to schedule pod on which has ssd disks
○ The scheduler also takes into account Quality of Service (QoS) requirements,
data locality, affinity, anti-affinity, taints, toleration, etc.
Kubernates
Controller Managers
Controllers are watch-loops continuously running and comparing the cluster's desired
state with its current state.
Kubernates
etcd : Key -value store
○ etcd is a distributed key-value database
○ etcd is based on the Raft Consensus Algorithm like distributed
database of docker swarm
○ etcd can run co-located on master node or external separate
distributed etcd nodes
○ etcd stores storing the
i. desired cluster state,
ii. network policy,
iii. ConfigMaps,
iv. Secrets,
Kubernates
Raft Consensus Algorithm
Visual explanation of Raft Consensus Algorithm
http://thesecretlivesofdata.com/raft/
Kubernates
Worker Node
● A worker node is host in cluster which has been added to cluster control plane. Worker
node provide compute and memory capacity to cluster . Workload or containerized
apps run on worker node in Pods.
● wokers node are server/ hosts traditionally which were used to run application
● A typical workload is a containerized microservices.
● Worker node hardware:
○ CPU
○ RAM
○ Root Disk capacity
○ Network Interface
○ Storage interface - optional
Kubernates
Worker Node : Component
A worker node constitutes of:
○ Container runtime
○ kubelet
○ kube-proxy
Kubernates
Container Runtime
Kubernetes does not have the capability to directly handle containers. In order to run and manage a
container's lifecycle, Kubernetes requires a container runtime on the node where a Pod and its containers
are to be scheduled. Kubernetes supports many container runtimes:
○ Docker - Market leader in containerized world, widely used with many orchestration engines
○ CRI-O - a lightweight container runtime for Kubernetes, it also supports Docker image registries
○ containerd - An industry-standard container runtime with an emphasis on simplicity,
robustness and portability
○ rkt - rkt is a pod-native container engine for Linux, it also runs Docker images
Kubernates
kubelet
● kubelet runs on each node and interacts with control plane component to ensure
cluster desired state is maintained for the node where kubelet is running.
● The kubelet take set of instruction and parameter, called specification that are
provided through various mechanisms like API server and ensures that the
● The kubelet doesn’t manage containers outside Kubernetes. (docker run containers)
● kubelet interacts with the container runtime (dockerd) on the node to run
containers with the Pod.
Kubernates
Container runtime environment
○ CRI-O : CRI-O enables using any Open Container Initiative (OCI) compatible
runtimes with Kubernetes.
Kubernates
Worker Node Components: kube-proxy
● kube-proxy is a agent that runs on each node in cluster,
outside of cluster.
● kube-proxy uses OS packet filtering layer does not implement filtering layer
Kubernates
Addons
Addons are cloud native application which can run on k8s cluster and provide
supplementary , it is written by 3rd-party pods a.
○ DNS - code DNS , manages domain name inside k8s cluster for services
○ Dashboard - Web UI to interact with kube-api server for cluster management
○ Monitoring - collecting stats on cluster , pod and host level and store in database
or generate alarms
○ Logging - collects cluster-level container logs and saves them to a central log store
for analysis.
Kubernates
Networking
Kubernates