Kubernetes Tutorial - Kubernetes Architecture Explained

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's going guys assalamualaikum welcome to amigos code so we're going to carry on the series where i hope to teach you kubernetes in the right way it's a really complex topic and a lot of people make it seem really complex but hopefully i want to make it super simple for you to understand in this video though i'm going to teach you about the kubernetes architecture if you're new to my channel go ahead and subscribe also give me a thumbs up and comment down below and let me know what you think about kubernetes or if there is anything that you want to learn please do let me know without further ado let's kick off this video let's go ahead and learn about kubernetes kubernetes originated from google where they've been deploying and working with containers for many years now and internally they have this tool called borg was a very successful internal system that allowed google to deploy billions of containers every week from porg then they developed omega and from omega kubernetes was born now just to note that kubernetes is actually written from scratch so it shares the same dna of borg and omega and the difference here is that it's open source so everything that developers at google have learned over the years developing borg and omega they took all of that knowledge and mistakes along the way and they came up with kubernetes so kubernetes is open source which means that both you and i can contribute to this awesome project fun fact kubernetes is actually written in golang which is an amazing language and if you want to learn about golan go ahead and check my website where i've got a course on golang now the easiest way for you to picture kubernetes is by looking at this picture so here you can see that we have this cargo and kubernetes really it means pilot it's a greek work that means elseman or pilot you can see that the ship has a bunch of containers and then kubernetes is actually managing all of these containers now if you know about containers and docker then this should be somewhat familiar to you and if you need to learn about docker and containers go ahead and check my website where i've got a course waiting for you on docker so let's dive a little bit deeper and understand kubernetes so kubernetes aka kate where the eight is the eight letters in between k and s is an application orchestrator so in this picture you can see that we have kubernetes and kubernetes orchestrates all of these applications when we are talking about applications we mainly refer to containers so kubernetes deploys and manages our containers it also scales up and down according demand it performs zero downtime deployments rollbacks and much more so knowing kubernetes will set you apart from many software engineers because right now the demand for people that understand kubernetes is quite high and the salary as well is super high so known kubernetes will take you a long step in your career now when we talk about kubernetes we need to first understand what a cluster is so a cluster is a set of nodes where a node can be a vm or a virtual machine and these can be running on the cloud such as aws azure or google cloud or even on premises now when we talk about the kubernetes cluster we have to understand the difference between the master node and the worker node so the master node is simply the brains of the cluster so this is where all of the decisions are made and then the work nodes this is where all the heavy lifting work happens such as running your applications and both the master and the worker node they do communicate to each other via the cubelet which i'm going to teach you in a second now within a cluster you often have more than one worker node and for this particular cluster we have four nodes in total one master node and three worker nodes now that you know what the kubernetes cluster consists of next let me go ahead and dive deep into both the master and worker nodes right so you saw that within the kubernetes cluster we do have the master node now the master node contains what is known as the control plane the control plane is made of several components and they are the api server the scheduler cluster store controller manager cloud manager which talks to the underlying cloud provider api whether it's aws google cloud azure so on and so forth and all of these components within the master node they communicate via the api server and also we do have the work nodes but these are outside right so the master it's a node right so a vm that contains all of these components right here and then we have the individual work nodes which i'm gonna explain what they are in a second so now let's start by understanding what each of these components inside of the master node do so let's start with the api server now the api server is the front end to the kubernetes control plane all communications go through the api server this includes external and internal and it exposes a restful api on port 443 and also in order for you to talk to the api authentication and authorization checks are performed so in essence we have the api server if you are talking externally using cubectl client which you're going to learn later so here i'm saying cubecd i'll apply and then f for a file and this is a yamo manifest i'm going to teach you as well so this file is actually sent to the api server and also internal communication goes via the api server so you can see that this is a very important component next we have the cluster store where this really contains all of the state for our application so it stores the configuration and state and currently kubernetes uses ncd which is a distributed key value data store an entity is the single source of truth so it's our database right so like any other application that you build the database contains the source of truth so here if i use cubectl or cubecattle which you're going to learn in a second so if for example you want to apply a yaml manifest then that goes through the api server all the way to the lcd store so lcd contains the configuration for our entire state so in here i'm in the official website for ncd and you can see that they say it's a distributed reliable key value store for most critical data and distributed system you see that the features it's simple interface it has a key value storage you can see that it stores the data really organized in directories as in the standard file system and here it watches for changes on specific directories and it also reacts to changes and you'll see why this is important in a second so if i scroll down you can see that the adapters so here kubernetes is the backend for service discovery and stores cluster state and configuration so this is really important this is really important and also you can see that lcd is written in go which has excellent cross-platform support small binaries and great community behind it and communication between lcd machines is handled by the raft consensus algorithm so you're going to learn about this later in this course but i just wanted to show you that ncd is really really nice and it's been adopted by quite a lot and projects and you should be aware and familiar with it now let me go back to the slides and learn about the scheduler so the scheduler watches for new workloads pods and assigns them to a node based on several scheduling factors is the node healthy does it has enough resources is the port available affinity and anti-affinity rules and other important factors so you can see that it's a really important component next we have the controller manager so this is a daemon that manages the control loop so basically it's a controller of controllers in kubernetes we have a bunch of controllers and let me just show you the node controller and what this controller does is whenever the current state doesn't match the desired state then it reacts to those changes in our example here we are setting the desired state equals to one node and this is not the actual way to do it but this is just an example and if we have one node then if this node dies right so if this node has a problem maybe maybe it has a disk failure or it ran out of memory or any other factor so if this node dies then the node controller is responsible for bringing another node so you see here so this is the purpose of the node controller we have other controllers such as the replica set which is responsible for ensuring that we have the correct number of ports running we have the endpoint controller which assigns ports to services namespace service accounts and others and to put it this way what the controller manager does it simply watches the api server for changes and the goal is to watch for any changes that does not match our desired state so we have a desired state and we have the current state if the desire doesn't match the current state then the appropriate controller kicks in to try and match the desired state so a controller is simply a watch loop we also have the cloud controller manager and the cloud controller manager is responsible to interact with the underlying cloud provider such as aws azure or google cloud so in this example here we have a bit of configuration and you're going to learn about all of this and what it means but basically this configuration right here or this manifest i've called ingresto yamo contains an ingress and this gives us a load balancer now first this request goes through the api and then that gets stored and then the cloud controller manager kicks in now depending whether you are running kubernetes on aws for example then it creates the load balancer which is an alb application load balancer if you're running within azure then it creates the equivalent but using the azure cloud api the same for google cloud so you see that the cloud controller manager is responsible for interacting with the underlying cloud api provider so you've seen how it does it for load balances but it's the same with storage or instances so these are vms and to be honest these are all of the components for the master node that makes up the control plane so the master in a nutshell runs or clusters control plane services and as i said before it's the brains where control and decisions are made and there we go you now know about the control plane and master node next let's go ahead and learn about the worker nodes so you've learned about the control plane in master node now let's focus on the work nodes so as i said before the work nodes this is where the heavy lifting work happens so the work node is a vm or a physical machine often running linux it provides the running environment for your applications so this is our worker node and inside we have the application so right here so we have a pod and you're going to learn about pods later but this is for now you can think of a pod as a container in the darker world and one thing to note here is that when deploying your applications you should really be deploying microservices so here we have three microservices so microservices a b and c if you want to deploy monolithic applications then you should really be considering splitting into small micro services because this is where kubernetes does shine and also microservices is the standard these days and this is where the industry is moving so moving on to worker nodes the work node has three main components so if we look into it so here we have the work node and inside of each worker node we have the cubelet which is an agent and you're going to learn in a second what it is you also have the container runtime i'm going to explain this in a second as well and also we have the cube proxy and remember i said that the node itself is actually a vm or a physical machine so in this example let's say that this is a vm which runs linux with four cores 32 gig of ram and 100 gigabytes of ssd storage so you can see that this node has three components cubelet container runtime cubeproxy and it runs on linux so let's learn about the cubelet so the cubelet is the main agent that runs on every single node it receives port definitions from the api server it also interacts with the container runtime to run containers associated with that pod and it reports node and pod state to the master node through the api so here you can see that the api talks to the cubelet and the cubelet also talks back via the same channel and the cubelet also interacts with the container runtime so what is this container runtime well the container runtime is responsible for pulling images from container registries such as docker hub gcr ecr and acr so these are some of the popular ones but basically it's responsible for pulling images starting containers from those images and also stopping containers so the main thing here is that it's responsible for running containers and it abstracts the container management for kubernetes and within it we have the container runtime interface and this is an interface for third-party container runtimes so you might have heard that docker was recently deprecated by kubernetes and this is because it's in favor of of container d which is becoming now the standard container runtime for kubernetes so let me quickly show you so right here i'm inside of the continuity official page and you can find the link for this website under the description of this video and you can see that they say it's an industry standard container runtime with an emphasis of simplicity robustness and portability and as of the 20th of february of 2019 container d became part of the cloud native computing foundation following kubernetes prometheus and others so basically you could see that they explained the ecosystem in here and right here you can see that we have the cubelet and right here we have the container runtime and here they say that it manages the complete container lifecycle of its host system from image transfer and storage to container execution and supervision of low level storage to network attachments and beyond so i'm going to leave the link for this page right here you can see the adapters so ibm cloud kubernetes service google cloud right here um docker as well instagna firecracker and others so go ahead and check this link to learn more about continuity if i go back to the slides and move on to the last component within the worker node which is the cube proxy so the q proxy is an agent that runs on every node through a daemon set and it's responsible for local cluster networking it makes sure that each node gets its own unique ip address and it's also responsible for routing network traffic to load balance services so you're going to learn about all of this in a second so for example if two pods want to talk to each other so cube proxy is was doing the magic if you as a client wants to send a request to your cluster cube proxy it's responsible for handling all of that so there you have it now you know about the three main components within the worker node and also you've learned about the control plane which gives you the complete picture of the entire kubernetes architecture so knowing all of these components and how they work together will make you understand everything once we start using kubernetes if you have any questions go ahead and drop me a message otherwise let's move on right so you've learned about the kubernetes architecture in the next video what we're going to do is learn how we can have a local kubernetes cluster running on our local machine and obviously throughout the next videos you'll see all of the components that make up the control plane as well as the components within the worker nodes in action so you'll see all of that in action so don't forget to subscribe give me a thumbs up let me know what you thought about this video and i'll catch you in the next one you
Info
Channel: Amigoscode
Views: 13,008
Rating: 4.9494472 out of 5
Keywords: kubernetes, kubernetes tutorial, learn kubernetes, kodekloud, kubernetes tutorial for beginners, kubernetes course, kubernetes crash course, kubernetes ingress, kubernetes networking, kubernetes complete tutorial, kubernetes full course, kubernetes full tutorial, kubernetes helm, kubernetes services, kubernetes volumes, kubernetes pods, freecodecamp, kubernetes for beginners, kubernetes deployment, what is kubernetes, amigoscode, kubernetes architecture, k8s, devops, networkchunk
Id: 1vnA13v8PcA
Channel Id: undefined
Length: 21min 8sec (1268 seconds)
Published: Wed Apr 21 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.