You are on page 1of 25

Agenda

• Docker Overview
• Kubernetes Overview
• Kubernetes Architecture
• Master Node
• ETCD
• Kube API Server
• Kube Controller Manager
• Kube Scheduler
• Worker Node
• Kubelet
• Kub Proxy
• PODs
docker
overview

It is basically a container engine that uses the Linux Kernel features like
namespaces and control groups to create containers on top of an operating
system.
What are containers?

Processes Processes Processes Processes


Network Network Network Network
Mounts Mounts Mounts

Mounts
Docker

OS Kernel
What can it do?
Container Container Container Container

• Containerize Web Server Database Messaging Orchestration

Applications

• Run each service with its


own dependencies in
separate containers Libs Deps Libs Deps Libs Deps Libs Deps

Docker
?

OS

Hardware Infrastructure
Kubernetes
overview

Kubernetes (K8s) is an open-source container orchestration engine developed by


Google.

It was originally designed by Google and is now maintained by the Cloud Native
Computing Foundation.
Kubernetes Architecture

Before we start full-fledged deep dive into Kubernetes, understanding the architecture is beneficial.

ETCD, API Server, Scheduler, Controller Manager, Cloud Controller Manager.


Kubernetes Master consists of five major components that are highlighted in red.
The following table describes the five components of Kubernetes Master.
Kubernetes Worker Node consists of two major components:
Node components run on every worker node of the Kubernetes Cluster.
K8s Component - ETCD

etcd is a distributed reliable key-value store.

etcd reliably stores the configuration data of the Kubernetes cluster, representing the state of the cluster (what
nodes exist in the cluster, what pods should be running, which nodes they are running on, and a whole lot
more) at any given point of time.

Important Pointers for ETCD

A Kubernetes cluster stores all its data in etcd.

Anything that you read while running kubectl get pods is stored in etcd

Any node crashing or process dying causes values in etcd to be changed.

Whenever you create something with kubectl create / kubectl run will create an entry in the etcd.
key-value store Tabular/Relational Databases

Name Age Location Salary Grade

John Doe 45 New York 5000

Dave Smith 34 New York 4000

Aryan Kumar 10 New York A

Lauren Rob 13 Bangalore C

Lily Oliver 15 Bangalore B


Key Value
key-value store Name Dave Smith
Key Value Age 34
Name John Doe Location New York
Age 45 Salary 4000
Location New York Organization ACME

Salary 5000

Key Value Key Value Key Value

Name Aryan Kumar Name Lauren Rob Name Lily Oliver

Age 10 Age 13 Age 15

Location New York Location Bangalore Location Bangalore

Grade A Grade C Grade B


K8s Component - kube-api server

API server acts as a gateway to the Kubernetes Cluster.

When you interact with your Kubernetes cluster using the kubectl command-line interface, you are
communicating with the master API Server component.

The API Server is the only Kubernetes component that connects to etcd; all the other components must go
through the API Server to work with the cluster state.

The API Server is also responsible for the authentication and authorization mechanism. All API clients should be
authenticated in order to interact with the API Server.
Kubernetes Architecture
curl –X POST /api/v1/namespaces/default/pods ...[other] 1. Authenticate User
Pod created!

2. Validate Request

3. Retrieve data
kube-apiserver Worker Nodes
Host Application as 4. Update ETCD
Containers

Container Runtime
5. Scheduler
kubelet Engine
Controller- ETCD Run containers
manager
CLUSTER 6. Kubelet

Worker Nodes
Host Application as
kube-scheduler Containers

Master kubelet
Container Runtime
M anage, Plan, Schedule, Engine
M onitor Nodes Run containers
K8s Component - kube-scheduler
Kube-scheduler watches for newly created pods that have no node assigned and selects a node for them to
run on.
Kube-Scheduler
CPU: 10

1. Filter Nodes

2. Rank Nodes

4 4 12 16
6
2
Controller Watch Status

Remediate Situation

Node Monitor Period = 5s

Node Monitor Grace Period = 40s


Node-Controller kube-apiserver
POD Eviction Timeout = 5m

kubectl get nodes


NAME STATUS ROLES AGE VERSION
worker-1 Ready <none> 8d v1.13.0
v1.13.0
worker-2
worker-2 NotReady <none>
Ready 8d v1.13.0
UNREACHABLE
Controller Watch Status

Remediate Situation

Node Monitor Period = 5s

Node Monitor Grace Period = 40s


kube-apiserver
POD Eviction Timeout = 5m

Replication-
Controller
Controller Watch Status

Remediate Situation

Node Monitor Period = 5s

Node Monitor Grace Period = 40s


Service- Node-
CronJ
Account- C ntroller POD Eviction Timeout = 5m
Deployment- ob
Controller o
Controller
Job- Statef P --
Controller ul-Set VControll
Binder r
Namespace-
Controller e

Endpoint- PV- Replic Replication-


Protection- aset Controller
Controller Controller
Controller Watch Status

Remediate Situation

Node Monitor Period = 5s

Node Monitor Grace Period = 40s

POD Eviction Timeout = 5m

Kube-Controller-
ServiRSteplatce-

Manager
-
oespaceoroc
atymdebn-
t---
ccoefcaseuul-n
CCCt Coo oon n
nn Jectottto
rorororor
ororobilllll
llerererere
rererer
ConnSettt
trorolller
Kubernetes Architecture
Master Worker Nodes
M anage, Plan, Schedule, Host Application as
M onitor Nodes Containers

Register Node

Create PODs
kube-apiserver
kubelet Monitor Node & PODs

ETCD
CLUSTER

Controller kube-scheduler kubelet


-Manager
Kube-proxy
POD
Network

1 0.32. 0.14 10.32.0.15


10.96.0.12 10.32.0.15 10.96.0.12 10.32.0.15

Kube -proxy Kube-proxy

service: db
10.96.0.12
1. Kubectl writes to the API server (kubectl run mywebserver --image=nginx)

2. API server will authenticate and authorize. Upon validation, it will write it to etcd.

3. Upon write to etcd, API Server will invoke the scheduler.

4. Scheduler decides which node the pod should run and return data to API server. API will
in-turn write it back to etcd.

5. API Server will invoke the kubelet in the node decided by the scheduler.

6. Kubelet communicates to the docker daemon via Docker socket to create the container.

7. Kubelet will update the status of the POD back to the API server.

8. API Server will write the status details back to etcd.

You might also like