Wednesday, 22 May 2024

kubernetes summary

in 2014,google introduced kubernetes an open source platform written in

go lang and later donated to CNFC

online platform for k8s -------------------------------------

kubernetes playground

play with k8s

play with kubernetes classroom

cloud based kubernetes services

GKE-- google k8s

AKS--azure k8s

EKS-- amazon elastic kubernetes services

kubernetes installation tool

minicube

kubeadm

problem with scaling up the continers

containers cannot communicate with each other

autoscaling and load balancing was not possible

containers had to be managed carefully ----------------------------------------------------

features of kubernetes

orchestration (clustering of any no of containers running on different entwork)

autoscaling

autohealing

load balancing

platform independent ( cloud/virtual/physical)

fault tolerance ( node /pod failure)

rollback (going back to previous version)

health monitoring of containers

batch execution (one time sequential, paraller)

Pod – once pod get failed or corrupted,, it cannot be created again

New pod need to create with new ip address and old ip address cannot be assinged

Pod will have ip address to communicate

Container will not have any ip address

Pod can have multiple containers. But if once container fails all container fails

Kube-proxy --- it will do networking part

Etcd-cluster – is like data base it will hv info about pod etc

Control manager – will have actual state and will work on desired state

It will validate the current status of the pod and will work on desired state

Control manager will communicate with api- server and

Api-server will communicate with kube scheduler to create pods or next action plan

Under pod we create containers

Kubernets will not talk to container

Kubernetes will talk to pod

Pod will have ip address

Cluster means group of pods

.yml or jason

Master node: if you install master package it will become master node

Image ------------------------------

working with kubernetes ----------------

we create manifet (.yml)

apply this to cluster ( to master ) to bring into desired state

pod run on node, which is controlled by master

role of master node

kubernetes cluster contains containers running or bare metal/vm instances /cloud instances/ all mix

kubernetes designates one or more of these as master and all others as workers

the master is now going to run set of k8s processess

these prcoesses will ensure smooth functioning of cluster these

process are call control plane"

can be multi mater for high availabity

master runs control plane to run cluster smoothly

One master --- one node

One master – multiple nodes

components of cotrol plane (master)

kube-scheduler

kube-apiserver

controller-manager

etcd

kube-api-server (for all communications)

this api-server interacts directly with user (i.e we apply yml or json manifest to kube-apiserver)

this kube-apiserver is meant to scale automatically as per load

kube api-server is front-end of control plane

2.etcd

stores metadata and status of cluster

etcd is consistent and high available store ( key-value store)

source of touch for cluster state (info about state of cluster )

etcd has following features

1.fully replicated - the entire state is available on every node in th cluster

2.secure-implements automatic TLS with optional client-certificate authentication

3.faster-- bench marked at 10.000 writes per second ------------------

kube-scheulder (action)

when users make request for the creation and management of pods, kube-scheduler is going to take action on these requests

handles pod creation and management

kube-scheduler 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 config files and schedules the pods on nodes accordingly

Scheduler will decide which is the best to run pod

Which pod is empty it will discover

You can declare on this node the pod should be created or scheduler will identify the best node to create pod

Scheduler will decide which is the best to run pod

Which pod is empty it will discover

You can declare on this node the pod should be created or scheduler will identify the best node to create pod

Scheduler will decide which is the best to run pod

Which pod is empty it will discover

You can declare on this node the pod should be created or scheduler will identify the best node to create pod

Scheduler will decide which is the best to run pod

Which pod is empty it will discover

You can declare on this node the pod should be created or scheduler will identify the best node to create pod

controller manager

make sure actual state of cluster match to desired state

2 possible choices for controller manager

if k8s on cloud, then it will cloud-controller-manager

if k8s on non cloud, then it will be kube-controller-manager

components on master that runs controller

node-controller

for checking the cloud provider to determine if a node ihas been detected in the

cloud after it stops responding

route-controller

responsible for setting up network routes on your cloud

service controller

responsible for load balancers on your cloud against services of type load balancer

volume controller

for creating, attaching and mounting volumes and interacting with the cloud

provider to orchestrate volume

nodes (kubelet and container engine)

node is going to run 3 importand piece of software /process

kubelet

agent running on the node

listens to kubernetes master (ex pod creation request)

use port 10255

send sucess/fail reports to master

container engine ( docker )

works with kubelet

pulling images

start /stop containers

exposing containers on ports specified in manifest

kube -proxy

assign ip to each pod

it is required to assign ip address to pods ( dynamic)

kube-proxy runs on each node and this make sure that each pod

will get its own unique ip address

these 3 components collectively consist "node"

Kublet à will talk to API-Server and will give all information about the node to API-server

Kublet à is the agent on the node

manifest is yml file

pod --

smallest unit in kubernetes

pod is a group of one or more containers that are deployed together on the same host

A cluster is a grooup of nodes

A cluster has atleast one worker node and master node

in kubernetes, the control unit is the pod, not containers

consists of one or more tightly coupled containers

pod run on node, which is control by master

kubernetes only knows about pods (doesnt know about individual continer)

cannot start containers without a pod

one pod usually contains one container POD ---

Multi-container PODS

share access to memory space

connect to each other using local host

share access to the same volume

containers within pod are deployed in an all or nothing manner

entire pod is hosted on the same node (scheduler will decide about which node)

POD limitations ---------------

no auto healing or scaling

pod crashes ----------------------------

boot strapping the master node ( in master )

to initialize k8 cluster

kubeadm init

configure master node

go to master

kubectl get nodes -----------------------------

kubernetes objects

kubernetes uses objectes to represent the state of your cluster

what containerised applications are running ( and on which node)

the policies around how those applications behave, such as restart policies,upgrades and fault tolerance

once you create the object, the kubernetes system will constantly work to ensure that object exist and maintain clusters desired state

every kubernetes object includes 2 nested fields that govern the object config

the ""object spec and the object status""

the spec which we provide, describes your desired state for the object the characteristics that you want the object to have

the status describes the actual state of the object and is supplied and updated by the kubernetes system

all objectes are identified by a unique name and UID

the basic kubernetes objectes include

pod

service

volume

name space

replicasets

secrets

onfig maps

deployments

jobs

daemonsets -----------------------------

relationship between these objects

pod manages containers

replicaset manage pods

services expose pod processes to the outside world

configmaps and secrets helps you configure pods

kubernets object ---------------------

it represents as JSON or YAML files

you create these and then push them to the kubenetes API with kubectl

state of object ------------------

replicas (2/2)

image (tomacat/ubuntu)

name

port

volume

startup cmd stop

detached (default) ----------------------------

kubernetes objects management

the kubectl command line tool supports several different ways to create and manage kubenets object

imperative commands -- live objects -- development projects

declarative object -- individual files (yml/json) --- production

declarative is about describing what you are trying to achieve, without instruction how to do it

imperative, explicitly tell "how to accomplish it"

configuration

No comments:

Post a Comment

devops interview questions

Terraform* 1. Terraform workspace 2. ⁠what are Mera arguments 3. ⁠what’s difference b/w for each and dynamic block 4. ⁠provisioners in t...