0% found this document useful (0 votes)
3 views10 pages

Kubernetes Notes

The Kubernetes Handbook provides an overview of Kubernetes as an open-source container orchestration platform that automates deployment, scaling, and management of containerized applications. It covers key concepts such as Kubernetes architecture, Pods, Deployments, Services, ConfigMaps, Secrets, and persistent storage. The document also includes practical tips and best practices for using Kubernetes effectively.

Uploaded by

bindu.5.shkr
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
3 views10 pages

Kubernetes Notes

The Kubernetes Handbook provides an overview of Kubernetes as an open-source container orchestration platform that automates deployment, scaling, and management of containerized applications. It covers key concepts such as Kubernetes architecture, Pods, Deployments, Services, ConfigMaps, Secrets, and persistent storage. The document also includes practical tips and best practices for using Kubernetes effectively.

Uploaded by

bindu.5.shkr
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
—* @codewithZ e— Page 1 & Kubernetes Handbook 1. Kubernetes Fundamentals What is Kubernetes? Kubernetes is an open-source Container Orchestration Platform. Tk automates deployment, scaling, networking and Kubernetes helps you ' i | run containers at scale ' i management of containerized applications rer er efficient. way. Originally developed by Google. Often referred. to as KBs. “Why Kubernetes? Kubernetes Architecture (High Level) Using Docker alone is great for running containers, but managing them in production is hard. Kubernetes solves these problems. 4 Problems with Docker alone | Docker Image X Marwal deployment of containers 1 X Manual. scaling X No self-healing Cif a container des, it stays dun) 3.2 oe X Difficult load balancing f X Rolling updates and rollbacks are hard Sa Running Pods X No built-in service discovery mus You define the desired ee Kubernetes makes it happen! Y Container Orchestration | V Relling Updates eee eee Se ¥ Auto Scaling | ¥ Rollbacks V Self Healing | ¥ High Availability Y Lead Balancing |v Resource. Management V Service Discovery | ¥ Declarative Configuration Yay. Interview Tip ‘a Docker is used te build and run containers. Kubernetes is used to orchestrate, scale and manage containers. Decker packages the application, Kubernetes runs it in production —* @codewithZ «— Page 2 Kubernetes Handbook — 2. Kubernetes Architecture A Kubernetes cluster has a Control Plane (Master) that manages the cluster and Worker Nodes that run the containerized applications Consistent ard highly Watches for nemly Rune. controlar unilble key-value creed Pods and processes that store for all cluster selects the best regulate the state data Control Plane. (Master) Worker Node(s) Exposes the Kubecutes APT We ewareseobsinrs ore AL conponents canmunicate through rode for them. of Ua caster running tagether Key Components Explained kube-apiserver - The front-end for the Kubernetes control plane. Validates and processes REST ated. scheduler requests and updates the cluster state. ~ Distributed key-value database used to store all cluster data. ~ Assigns Pods to the best suitable node based on resources and constraints controller-manager - Runs controllers like Node Controller, ReplicaSet Controller, Endpoints Controller kubelet, kube-proxy to keep the cluster in desired state = Ensures that containers ina Pod are running as expected. ~ Handles networking and ensures traffic is routed to the correct Pods. Container Runtime - Software that runs containers (e.g., containerd, Decker). ‘How it Works? i 1. You create @ resource (eg., Pod, Deployment) using kubectl. | Control Plane (teow bes ta La eee, \ “ 4 3. Scheduler decides which node should run the Pod. | emer) (ia aa) (ena | (Wee Neda) [rer Nee) «» (Werle NaN 4, aon hal es cus Pl ad starts eines, | 5. Kabe-prony enaures the Fou. is reachable via. network | Neeser 6, Colrlin entnnaly nrter onl mania te nied cote} | @ @ | | SSS -- SO L Interview Tip Kubernetes works on the principle of “Desied Skate ve Actual. State” 4 The control plane constantly works to make the actual state match the decired state —* @codewithZ *— Page 3 Kubernetes Handbook 3. Pods - The Smallest Deployable Unit A Pod. is the smallest and simplest Kubernates object. It represents a single instance of a running process in your cluster Pod Structure Key + A Pod can contain one or more containers Points + Containers in a Pod share the same network namespace (same IP and port space), + They can also share storage volumes * Pods are ephemeral (temporary). ‘+ When a Pod is deleted, it is not recreated by Kubernetes “Types of Pods + Single Container Pod Contains only one container. Pod with Tnit & Sidecar + Mulki Container Pod Contains muliple containers thal work together Succeeded + Tait. Container (Conplated sscanflly) ars befor ta rein codeine! Foiled © Sidecar Container (Cesc) Runs alangtde the main container to extend ite functionality “Common Pod Commands i } Command, Description Icopveaoney! ' f 1 Taba gh pode Uk a a nen ae 1 — ieiadata: ' Tab dip Gptvane>_| Slew ded formalin dk «Pl ligcaeeea | 1 = 1 Talal lags getana ies lige fw eae oP | pa ' ' uct eit Spode ch | Dp bell ed, the Pel Tabet oe at mpd =a] | containers: ' = Sees e cee ' jas adel Dale « Pd atl dle poll el das | fb pl Tit Pode with mare deals| beg pla a wide | pt | abectl get pode —-vate Watch Pods in real-time bell got pola vale | | Sear 205 Interview Tip + Pos are designed to be short-lived ond replaceable + Use Deployments for managing Pode in production (not Pode directly) + Tf a Pod fails, create « naw Pod instead of fixing the old. one oo — @ codewithZ’ — Page 4 E> Kubernetes Handbook 4. Deployments - Declarative Updates for Pods A Deployment manages ReplicaSets and ensures the desired number of Pod replicas are running. Tt provides declarative updates, rollbacks and scaling. (ances Deployment. Architecture + Deployment: Manages ReplicaSets and Pods. + ReplicaSet: Ensures specified umber of Pod replicas are running + Desired State: State defined in the Deployment manifest is the desired state. Rolling Update: Updates Pods gradually without dowaline + Rollback: Reverts to a previous version easily + Sealing: Increase or decrease the number of Pod replicas. “os Digan Wek res 1. You define the desired late in a Delayent YAML 2. Kaberntes cestes/apdates a RplcSet Old Versien Update 3. RepleaSeh creates the requred number of Pos Pals Progress 4. fo Po fas, Repel replaces i (slhaig) Se el | See 5 When yo update the nage Donat prema a alg te) |e vt | Lt hv 6. OU Pos are gray replaced sth new Pod = 7. You can rollback to previous revs if nde (Ap No tine! Treffie saline sored by belly Poin} Deplognert WML (Maina) Design Example Sse te ois Tape go Cae pia « Dyn | Hanalei Fgetgtyapt | | kid Deployed La gt dpe a Dg ea get dros ee ee a aie dnt an | Be Ma nat daniel ane | | | st tn vee =, - recs! 8 ae rind ag nn ome> | Vin rally Nt nt tng ngs | | deter ee ee ee aes ee a cea aegis] || eae | 2 aes : ae: a ee el, eats W Scala nga delognet to 5 veplcas certains lubectL scale deplognant nginx —replicossS | ot Se ae ie heise ous osu: requrte Soe path: tery Y Use Fie intend of erPath foe portal Cheat the ght etn mele fir par wend Interview Tip We Un ig Fw bh ee ok tony ete acy ae Y Use StorageClass fir dente proving Wf erie Peep NG ob Va op np dat J Sapte opts ot fon be * ele. @-8-8-oa Felines line ped the fe me Ww ehgiaten FNC is the badge tak cnt the tam {Une Volant) eget) or (lean Soege) —* @codewithZ e— Page 8 i Kubernetes Handbook 8. Configurit Lications Kubernetas provides several ways to configure applications without rebuilding container images. Key Conceple © Gani For concn cfr in dee S Besce rceetsio s 1E eee tokens, cerifctes lesecapratt Sus Sete syeateh par = Command & Arge: Override container startup basen © Volume Mounts: Provide config, files inside cantainers | rivet a | Pa tn ieee Fe pot Seal | octave Soe fis | ee Le al hye frn | Metre tle fen bea” oe roe oo She ete | | it ip ! aly peaediats Ered (ea) lara ee we aa the ee Be tt srsifie wena ey, Mant Cohen eae tio fie aeerees ae ons aiot [Bat fe [fw Woe ] ~ tay pee So es ert _| te = Cnitap | atin a er we fin_| yeni ae = a a Ae Noor a Saows o eeu Cini as ee Sete culo oe Wane nls | Fes 7 nfs | Hast ofl | Gai fl, wots Une werypin akon RAC ‘tr oe anon for many variate Be Karp eign seperate frm pin code Orrin the defeat lod Pde te ik ap Cofig/ Ser changes age: ng ts | cman dead = aoe : cooeund. el wee oe Best Practice | Uke Cai fe min cain te Sef etn a tl Ik pe A), fae ee Eee ae See fo aa Sos aah of Sart Interview Tip, (Cage and Sele rede alain mprai bnisfteron t,t Seals we mat 100% secure by defant—erale encryption and Un sen + pried Wife anfigrli we eerie oie fl —* @ codewithZ *— Kubernetes Hirdbosk = 9. Configuring Applications (Advanced) This section covers advanced configuration techniques. for real-world, applications ies) + Resources: CPU/Mamory quate and. Limite 4 Health Chacke: Livense, Readines, Startup probes + Confighaps & Secrets: External. configuration ¢ Dawnward. APL: Expose Pad/Contsinar metadata to applications, ©. Init. Containers rein containre |Health Checks (Probes) Pod Resource Management ‘lugs set bath requests and Unite for predictable parformance and. scheduling Ran setup tasks before ® Fae faa Ven Gad [Rites Ree == = Uy: Refi we HTTP GET ea Start Pabe | Cha of opp ie ted | Siow sering opp | SE _ epleckah: Chak of TEP pet is ap Eat Beesils and tr Lins Poke | Chef gp aloe 2 Tange Raalnaw Pre = NiyGa) Chak f agp rudy Ped renond fom rendinaeePrebe Rea Pa | Oe Sp em | A pe “ falrTirebelas 3 (eee Acreage) Ph meee a eee nes ae eure |) ead, = wane: POD_IP sepa for . i Soe || Sees she fo the ro | nr FieldPath: status ped? | ec Paani oparoh a ae = == ee (=e eee [pet peak dedi : Heels sirvegirs © Wee Wea Pa Aaa (PR) for remade © Ds nk ak PL Lt ts oe (anes tg) a cat mes oe : a ce i Fae et ee rear, |S OE Fete wt eg or es % fing bese pete (ome tae eh | cna 80 pte Howington ot entree un lp i z wee Sees ae | a stmt | fal Ca Tudela petra l See | @ Pt Fratce 5 Esraac anges wg Cente Sea © Epa ta. fewest Um ed ade pb © We phe © ope ry dey 1 fan en can oft er co emer EL pda das snd deg 5 Underdog + Meats safe aig Hn Katies SE : ely to wile YAM for adel Pod us —+* @ codewithZ »— Pace 10 Kubernetes Handbook 10. Deployments & Updat Deployments provide declarative updates for Pods and RepicaSets | Concept How a Deployment. Works «Deployment: Manages RepiaSets ond. provides Alacartin. updates. + RepicaSet: Ensues the desired narber of Pa replicas + Rellng Update: Gradual update with sere downing ; Re ae soy. 1 ell he Dynes — Kalter a aint to 0 presous verson + Tae oe opal gradually (Rling Uplala + Stategen: Rllnghpate (deft) or Recrae (Deployment YAML (Exanple) { epiverion: appe/et Serer eget (SEER Toni Vn Ue as Fatngdale | Gad ope Pde wth | Renda for {tee (Default) rw Pods. Ensures zero dwntine. | mest epplicaions euseeen | are Trini ll ad i bjs | For epltins th | eins 2 Sete pele | | Saaaatieee sco ravanhlde natchLabls Makati eea [een Ya Nes Repeal See Rapa we 4 Grek dala 2. Now Relea te 3, Toe are ron felt ie: | es Bs lid guts 5 Daa 5 es Cea dia an pee seu pore Tok dag [beg earns Siw Us of = ge) | al dae digg o aa a done Chek red stn at lain nope Te a eg apart ge | Ue ine of = gape [ak a rage tog mgr grasp 3 Taha tia iy pine ar So wt any Tete hay depagant/ngpe | Ta rll one penta open roe Tat ict wk dere _Ralack Emgle _Deplaynent Status (4 chuck stn Katey } Condon at ee ee Tatas | ape aR oat 4 Raa Ae pt sin toot Oe a tae copied Re a I ae toe pees rinse. | Praag [Delage mang per [ne epee ties | ries | eager ae Bae Te © sitate Conman Mistakes Ye Wagan fr sk wend Xing ete aay fr prin eed Pg a nn rp oh 3 Repl beat eer 4, me a a XA sing ale a fr pe Yeap dees daa shan pnt [Link] danas ted of ring ah Y Un tte only fo eto Xing ane Cage Kg (6 I) id tne

You might also like