Kubernetes Tutorial | K8s Components Explained in 10 mins | Part-2 | JavaTechie

In IT Consulting


Kubernetes Tutorial | K8s Components Explained in 10 mins | Part-2 | JavaTechie - read the full article about Kubernetes tutorial, IT Consulting and from Java Techie on Qualified.One
alt
Java Techie
Youtube Blogger
alt

hi everyone welcome to java techie in  the last tutorial we just discussed the basic introduction of kubernetes right  where you understand what is kubernetes and why we need it in the microservice world so  now lets move one step ahead and deep dive into components of kubernetes before we start  let me tell you this is very important session you must need to know each component  before you start working with kubernetes so i would strongly suggest you to not  skip this and if you dont understand no worries watch it again and again until you get  the complete context okay so lets get started so these are the kubernetes components part node  cluster replication controller and replica set service deployment secrets config map and etcd  okay so these are the kubernetes components i will explain each and every components lets begin with  what is pod and node okay in kubernetes we are not interact with container directly the containers  are wrapped into a functional unit that is called pods okay and a port can have a single container  or it can have multiple container inside it and each part associate to a single ip address thats  how one part can talk to another part and there is another virtual or physical machine where  all parts wrapped into it that is called node okay so a node can have a single part or it can  have a multiple parts okay now again multiple nodes wrapped into another physical unit that  is called cluster so cluster either can have a single node or it can have multiple node okay  kubernetes cluster are comprised of one master node and a number of worker nodes these nodes can  either be a physical computers or virtual machines depending on the cluster you created okay now if  you will try to understand from backward direction we have a cluster and inside the cluster we can  have a single node or multiple nodes and inside each node you can have a single pod or multiple  parts and inside a pod either you can have a single containers or multiple containers okay so  far at high level we understand what is part node and cluster right now lets move into the next  component that is replica set as you understand in previous slide that pods are running inside a node  and each part associated to a unique ip address now lets assume i have pulled database image  and running that containers inside a port so let me name this pod as a database pod  okay as you know each application always need to interact with database but lets assume due  to some memory or cpu problem my database part got crashed now how my application will handle all  the traffic which is coming to this database parts which is not running it may leads huge cost impact  to my application isnt it so how to overcome this or how can i ensure that there is no application  downtime thats where replica set component came into picture which will act as a replica or backup  of your port for example lets say i created three replica for my database part when any of your  power will crash immediately kubernetes will bring up the new part from replica set and  it will assign a new ip to that specific port you can create as many replica you want for a  specific part and these things you need to specify at the time of creating the deployment object  i will talk about deployment object in a moment so far we understand how this replica set works  right if there is any parts goes down or some part got crushed immediately it will replace a new  pod with a new ip address now lets move into the next component that is service so as you know  inside a node we can have multiple parts lets name this part as a frontend part where my angular  or client application is running and another part i will name it as a backend part where my server  side code or springboard application is running and each pod assigned to an unique ip address  thats how they can connect to each other right front end port can talk to the backend part using  the ip address also you understand if any pod die then immediately replica set will bring up a new  port with new ip address okay but what if this will keep going i mean due to some problem pods  are keep dying and replacing with new pod with new ip address in such kind of situation my front  end part can connect to the backend part because ips keep changing right thats where service came  into the picture now each part will associate to one service or multiple parts can group together  into a single service with label and selector i will talk about this label and selector in  my future session with an example but for now lets assume one part associated to one service  okay where service will provide an static ip and dns name so going forward each pod can talk  to each other using dns name rather than using the ip address okay lets say if backend parts down  then under the hood replica set will replace a new backend part it wont impact to the front end part  because front end part still can able to connect to the back end part with service dns name because  the life cycle of parts and service completely different thats pretty cool isnt it apart from  managing the service discovery role service also plays the role of load balancer where traffic  coming to your pods will be handled by service then service will redirect to available parts  based on your loads there are different service type used in kubernetes like cluster ip node port  and load balancer this service differ by how you expose your parts internally or externally and how  you handle the traffic so i am not going to deep dive types of service now we will understand this  in our coming session with an example so i hope you understand enough information about service  component now lets move into the next component which is deployment deployments are kubernetes  object that are used for managing ports you can scale your application by increasing the number  of running ports or you can update the running application using deployment object also you can  configure number of power cpu memory everything through this particular deployment object if  you can observe below command keep ctl create deployment first deployment then docker image then  port number and we are specifying the replicas okay here we are telling to the kubernetes  that create a deployment object with name first deployment then pull image from local docker  repository or from docker hub and then create a active pod with four replica ports which you can  consider as a just a blueprint or backup of your actual ports so instead of using this command to  create deployment object you can also use the yml file which is nothing diplomat.iml file and you  can create a deployment object with that okay so in an example when we will do a spring boot cloud  application i will show you how you can create the deployment object using both command prompt  as well as the yml file approach okay now lets move into the next component which is secrets and  config map first of all both secrets and config map used to store sensitive information of your  application like password secrets key or api key lets say i deployed one springboot cloud  application to kubernetes usually you do configure our database properties in springboot  application.properties file or application.ml file right which is not secure if any changes done  in configuration again you need to rebuild your docker image then you need to deploy it to the  container which is a which is kind of rework for a developer isnt it why not well separately manage  this sensitive info outside of our application since we are using containerization platform  why not will directly use kubernetes component to store my sensitive information thats where  to manage secrets and configuration of your application kubernetes provided two components  secrets and config map these two are placed outside of pods so if you observe secret and  config map present outside of the parts so that inside a node if there is multiple part they  can point to the same secret and config map they can reuse the secrets which they configured  in the secret object okay and the main purpose of using two different component to store sensitive  information is that where in secret you can add sensitive information with encrypted format  however in config map it will store as a plain text lets say for example you are configuring  your data source properties then only the password you can configure inside the secret and rest  other url driver class name and username you can configure inside the config map object now  lets move into the next component which is atcd kubernetes used etc as a key value database  it store the configuration of the kubernetes cluster inside the atcd also it stores all the  secrets and configmap data inside utc database and the max limit is 1mb to store secrets okay so  this is what all about etc configmap and secrets well discuss more about these three component  when will deploy crowd application to kubernetes so i believe you understand good amount  of context about components of kubernetes so what all components will learn today in  my coming session will demonstrate all with real time example okay so in my next tutorial  well understand architecture of kubernetes thats all about this particular video guys thanks for watching this video  meet you soon with a new concept

Java Techie: Kubernetes Tutorial | K8s Components Explained in 10 mins | Part-2 | JavaTechie - IT Consulting