Kubernetes Course - Full Beginners Tutorial (Containerize Your Apps!)
Key Takeaways
This video provides a comprehensive tutorial on Kubernetes, covering its basics, architecture, and usage, including containerization, automated deployment, and scaling, using tools like Docker, MiniCube, and kubectl.
Full Transcript
kubernetes makes it possible to containerize applications and simplifies deployment to production bogden stachook will teach you everything you need to know to get started with kubernetes welcome to the kubernetes for beginners kubernetes is de facto standard for deployment of the containerized applications into production kubernetes is open source and therefore it is free for use let me first introduce myself before we will start this course my name is bogdansta shook and i've been using docker and kubernetes multiple years on practice and i deployed real world applications into production using kubernetes also i'm teaching online and on my personal website statute.com you could find all courses which i teach now let's get started with kubernetes for beginners and i would like to start with course plan so what is included in this course we will start by talking about terminology and the key features of the kubernetes and you'll learn what is kubernetes cluster what is node and what a spot and what kubernetes essentially does afterwards we will immediately dive into the practice and we will build small kubernetes cluster locally on our computers and afterwards using such cluster we will create and scale different deployments also we will build custom docker image push it to docker hub and afterwards create kubernetes deployment based on this customly built docker image other than that we will also create services and deployments in kubernetes using yaml configuration files also we will connect different deployments together because it's very common situation when you have to connect different applications together over their network and kubernetes allows of course to do that and also finally we will change container runtime from the docker to crio because kubernetes is not bound to docker it also supports other container runtimes like crio and container d and you could use kubernetes absolutely without docker one single prerequisite for this course is your familiarity with docker i assume that you know what is docker container and how to create different containers all right so let's get started with this course and i would like to start with definition kubernetes is container orchestration system using docker you could of course create container on any computer but of course if you want to create multiple containers on different computers on different servers you could get into the troubles kubernetes allows you to create containers on different servers either physical or virtual and all of that is done automatically without your intervention you just tell kubernetes how many containers you would like to create based on a specific image kubernetes is relatively long word and it consists of 10 different letters but it professionals and software developers are relatively lazy people and they don't like to type much that's why such a long word is usually shortened just to three characters but how is it done let's have a look at this word between k and s there are actually eight different letters so number eight that's why long word kubernetes could be shortened just to three characters k eight s so eight represents simply quantity of the letters between starting and ending letter simple as that knowing this very simple trick we could go on and now let me explain to you what kubernetes takes care of so kubernetes takes care of automatic deployment of the containerized applications across different servers and those servers could be either bare metal or physical servers or virtual servers virtual servers option is of course more common nowadays and almost no one uses no bare metal servers so kubernetes allows you to perform automated deployments across different servers that could be located even in different parts of the world other than that kubernetes also takes care of distribution of the load across those multiple servers and this allows you to use your resources efficiently and avoid underutilization or over utilization of the resources also kubernetes takes care of the auto scaling of the deployed applications in case you need to increase for example quantity of the containers which have to be created on different servers and all of that done automatically you just tell when you want to scale up or down also kubernetes takes care of the monitoring and health check of the containers and in case some containers fail for some reasons kubernetes could automatically replace failed containers and all of that done without your intervention as i just told you kubernetes deploys containerized applications and therefore it has to use specific container run time and docker is just one of the possible options kubernetes nowadays supports such container runtimes docker crio and container d and such container runtime for example as docker or crio must be running on each of the servers which are included in the kubernetes cluster and main outcome here is that kubernetes could be utilized even without docker at all it supports other container runtimes like crio and container d and at the end of this course i'll demonstrate to you how to change container time and move from docker for example to crio so now let's get started with terminology and architecture of kubernetes and let's start with pod pod is the smallest unit in the kubernetes world in docker world container is smallest unit in kubernetes port is the smallest possible unit and containers are created inside of the pot so what anatomy is following inside of the pot there could be containers either one or even several containers also there are shared volumes and shared network resources for example shared ip address this means that all containers inside of the same port share volumes and share ip address and you must keep that in mind if you want to create multiple containers inside of the same pot most common scenario of course is to have just single container per pot but sometimes when containers have to be tightened together and they heavily depend on each other and they could exist in the same name space it is possible to create several containers in the same pot but again single container per port is the most common use case also please keep in mind that each port must be located on the same server it is not possible to spread containers from one pot across different servers in the kubernetes cluster one port one server so let's now have a look at the kubernetes cluster what is that kubernetes cluster consists of nodes node is actually server either bare metal server or virtual server and you could include multiple such servers into the kubernetes cluster and they could be located in different data centers in different parts of the world but usually nodes which belong to the same kubernetes cluster are located close to each other in order to perform all jobs more efficiently inside of the node there are pods port is again the smallest possible unit in the kubernetes and inside of each port there are containers usually single container per pot and such pods are created on different nodes and all of that is done automatically for you kubernetes does this job but of course your job is to create such nodes and create cluster based on those nodes nodes will not automatically form cluster without your intervention but after such initial configuration everything will be automated and kubernetes will automatically deploy ports on different nodes but how those nodes actually communicate with each other and how are they managed in kubernetes cluster there is master node and other nodes in the cluster are called worker nodes and masternode actually manages worker nodes and it's master node's job to distribute for example load across other worker nodes and all ports which are related to your applications are deployed on worker nodes masternode runs only system ports which are responsible for actual work of the kubernetes cluster in general we could also say that master node in the kubernetes cluster is actually control plane and it does not run your client applications so which services actually run on different nodes let's have a look at this diagram there are such services as cubelet cube proxy and container runtime and those services are present on each node in the kubernetes cluster you already know what is the container runtime container runtime runs actual containers inside of each node and there are such container runtimes as docker crio or container d there is also such service as cubelet and such service on each worker node communicates with api server service on the master node api server service is the main point of communication between different nodes in the kubernetes world cube proxy which is present on each node as well is responsible for network communication inside of each node and between nodes also there are other services which are present on masternode and they are scheduler and such service is responsible for planning and distribution of the load between different nodes in the cluster also there is cube controller manager and it is single point which controls everything actually in the kubernetes cluster and it controls actually what happens on each of the nodes in the cluster also there is cloud controller manager and its job is interaction with cloud service provider where you actually run your kubernetes cluster because usually you don't create such clusters yourself using just your own servers instead you could very easily rent a kubernetes cluster from one of the cloud providers which actually perform almost automated creation of all nodes and the connections between such nodes and for that you have to run cloud controller manager service on the master node also for example if you want to create the deployment of your application inside of the kubernetes cluster which will be opened to outside world and allow connections from outside you could create also load balancer ip addresses and those load balancers ip addresses are usually provided by specific cloud providers also on masternode there is such service as etcd and this is a service which actually stores all logs related to operation of entire kubernetes cluster and such logs are stored there as key value pairs also there are other services which are running on masternode for example dns service which is responsible for names resolution in entire kubernetes cluster and for instance using a dns service you could connect to specific deployment by the name of the corresponding deployment service and in such a way you could connect different deployments with each other that are different services which are running on different nodes in the kubernetes cluster and the main service on the master node is api server and by the way using this api server service you could actually manage entire kubernetes cluster how is it done it is done by using cube ctl or cubecontrol and cubecontrol is separate command line tool which allows you to connect to specific kubernetes cluster and manage it remotely and cube ctl could be running even on your local computer and using such cube ctl tool you could manage remote kubernetes cluster and using such tool you actually connect using rest api to api server service on the master node and such communication happens over https by the way other nodes in the cluster i mean worker nodes communicate with master node in the same fashion it means that using such a cubectl tool you could manage any remote kubernetes cluster that's it for kubernetes architecture overview and now you know that the kubernetes cluster consists of the nodes and the one of the nodes is master node and it manages other nodes which are called worker nodes on each node there are pods and the ports are created automatically by kubernetes and inside of the port there are containers usually just single container per port also please keep in mind that all containers inside of the port share name spaces of that port like volumes or network ip address also ports are smallest units in kubernetes and the ports could be created that could be removed could be moved from one node to another this happens automatically without your intervention but you have to design your application with this in mind ports could be deleted on any moment of time also there are different services which are running on different nodes for example api server service is central point of communication between masternode and other worker nodes and also using such api server service you actually could manage actual kubernetes cluster using cube ctl tool which has to be installed for example on your computer if you perform management from your computer all right i don't want to dive deeper into the details of the kubernetes because this is very complicated tool and i want to focus more on practical tasks instead that's why now after such overview we will dive together with you into the practice and perform different practical tasks together for example we will create deployments services scale deployments create custom docker image and create the deployment based on that image and so on in order to perform all practical tasks together with me you have to install some programs on your computer and now let me talk about required software and first we have to create actual kubernetes cluster where we will create different deployments of course you could create cluster using services from one of the cloud providers like amazon web services or google cloud but you have to pay for such service if you want free solution you could create cluster locally on your computer and for that there is such tool as mini cube and such tool will essentially create just a single node cluster and this node will be both worker node and master node but for test deployments and as a playground it works pretty nice and all of that is free and will be running on your local computer in order to run mini cube successfully you have to utilize virtual machine or container manager and there are following virtual machine or container managers which are supported virtualbox vmware docker hyper id or parallels there are also other options available but you have to utilize one of such options in order to actually create the virtual node which will run all posts in your kubernetes cluster i suggest you to go ahead with hyper-v if you are windows user and if you are mac os user you could go ahead with virtualbox it is free and open source or you could utilize vmware or parallels by the way there is also an option to run mini cube as a container inside of the docker of course if you have docker already installed on your computer you could utilize it in order to create kubernetes cluster using mini cube and essentially it will create a separate docker container and inside of that container all posts will be created but i personally don't recommend to you to go ahead with docker option because there was some limitations for example i was not able to change a container runtime inside of the docker container to cri or or container d and therefore i recommend to you to go ahead with other options which i mentioned here by the way hyper v is available on windows computers out of the box and you could utilize it as virtual machine manager for running mini cube node to summarize using mini cube you will create single node kubernetes cluster but as i mentioned before you have to use specific tool in order to manage this cluster and this tool is called cubectl by the way cubectl is included in minicube but if you want to use such included version you have to enter minicube cubectl commands it is not convenient therefore i recommend to you to install cubectl separately and using separate installation you will be able of course to manage other kubernetes clusters which are located for example at amazon web services so cubectl is also one of the programs which you have to install on your computer certainly i'll explain to you how to install minicube and cubectl other than that we will also do some coding in this practical course and for that you have to use one of the code editors and i recommend to you to install visual studio code it is open source and free for use and if you have not yet installed it please go ahead and install it also it has many different extensions and one of them is kubernetes extension and using such extension you could very fast create for instance yaml configuration files for your deployments and services in kubernetes that's all what you need for this course mini cube cube ctl and visual studio code now let's get started with practical part and i hope you'll enjoy this course and we will start with the installation of the mini cube and cube ctl alright guys now let's get started with practical part of the course and we will start by installing mini cube along with cube ctl but first i would like to ask you to navigate to kubernetes.io this is the main site dedicated to kubernetes in general and it has all documentation related to configuration of the mini cube clusters creation of deployments etc please click here on documentation and here in the left section go to getting started and here you could read how you could create learning environment along with that you could also find information how to create production environment but we are interested to know in creation of the local kubernetes cluster and for that we will utilize mini cube and also we will install cube ctl that's why please click here on this hyperlink install tools and you'll find instructions how to install cubectl on different operating systems please choose yours i'll choose mac os here and if you're mac os user you could very easily install cubectl using homebrew let me demonstrate you how to do that let me click on this option run the installation command brew install cube ctl let me copy this command and open up terminal i'm using item 2 on mac and paste this command here let's go ahead and install cubectl downloading package and cubectl was installed let me check version of the cubectl for that i could utilize this command cubectl version client let me enter it here and i see that the cubectl was installed successfully and here is client version major one and minor 22 and here is actually exact version which was installed all right if you're a windows user i recommend to you to install cube cdl using package manager you could go to install and setup cube ctl on windows and here choose option install on windows using chocolaty or scoop click on this option and here you'll find instructions how to install different packages using chocolaty package manager or scoop command line installer i recommend to you to install chocolaty package manager in order to do that please open up this link here and find instructions how to install this package manager for windows using the same package manager you could very easily install mini cube as well so please go ahead and install this package manager and afterwards follow those instructions on how to install cubectl on windows use just single command this one and afterwards verify that cubectl is available using this command all right after this i assume that cubectl is already available on your computers and now let's go ahead and install minicube go back to getting started page and here scroll down to learning environment and click on hyperlink install tools this one you'll find again that you have to install cubectl that's what we just did together and if you scroll down you'll find options which you could utilize in order to create local kubernetes cluster for learning and testing purposes nowadays there are such tools as kind and it allows you to create kubernetes cluster locally on your computer but it requires docker also there is mini cube and cube adam we will utilize mini cube throughout this course that's why let's get started with installation of the mini cube it does not require docker but it does require one of the virtual machine managers like hyper-v parallels or if you want you could also utilize docker please navigate to this link mini cube you could simply enter mini cube in the google search bar and click on the first result in the output and here you'll find documentation how to get started with minicube please click on this link get started and here you could read about minicube and it will basically create the kubernetes cluster locally on your computer and it will contain just a single node which will act both as master node and worker node and all what you need in order to create such a cluster is just single command mini cube start simple as that but in order to successfully create a mini cube cluster you have to install one of the container or virtual machine managers such as docker hyperkit hyper v parallels and so on i told you before that if you are windows user i recommend to you to utilize hyper v because it is available on windows out of the box if you are mac user i recommend to you to go ahead either with virtualbox option or parallels or vmware fusion virtualbox is free for use therefore if you don't want to pay anything for virtual machine manager i recommend you to go ahead with this option also it is possible to create mini cube cluster inside of the container docker container and for that you could just install docker but i personally don't recommend to you to go ahead with this option because there are some limitations in running such a cluster inside of the docker container alright here below you could find out how to install mini cube on different operating systems linux mac os and windows if you are windows user you could similarly as with cubectl utilize chocolaty please select this option and enter just single command choco install mini cube simple as that and you'll get mini cube installed on windows computer but i'm using mac os that's why i'll select this option and select homebrew and in order to install mini cube using brew i could simply enter just one command brew install mini cube let me go ahead and install it using brew let's go back to terminal and here paste command brew install mini cube let's wait a bit until it is installed all right mini cube was installed and now i could verify its version mini cube version here is version in my case and you could also enter mini cube help command in order to find the list of all available commands in minicube and if you scroll up you'll find out how to start local kubernetes cluster get status of the local kubernetes cluster stop cluster delete and open dashboard also you could to pause and unpause kubernetes cluster great now let's create actual cluster i assume that now you have also installed mini cube and cube ctl those tools are two separate tools that's why they are available as two separate commands mini cube and cube ctl and now let's go ahead and create kubernetes cluster for that please utilize command mini cube start but first let's enter mini cube status in order to check current status of the cluster mini cube status here i see that profile mini cube not found run mini q profile list to view all profiles and also i see that in order to start cluster i have to run mini cube start command that's what we are about to do right now let's create cluster mini cube start and here i would like to ask you to start mini cube cluster with option and this option will be driver and you should write it with two dashes dash dash driver and here will be equal sign and after it you have to specify virtual machine or container manager which you would utilize in order to create mini cube cluster i mentioned before that if you are windows user i recommend to you to use hyper v therefore if you are on windows simply enter here hyper v like that all lower case without dash dash dash driver equal assign hyper-v if you are mac os user you could go ahead with any of those options virtualbox parallels or vmware fusion i will utilize virtualbox if you don't have your toolbox please go ahead and install it enter here your toolbox and click on the first link here your toolbox is free and here is link where you could download virtualbox so if you don't have your toolbox and if you're a macos user please go ahead and download virtualbox great i already have your toolbox installed that's why i will simply specify it as the value for the driver option here so i will type virtual box let's go ahead and create mini cube cluster inside of the virtualbox virtual machine in my case creating virtualbox virtual machine quantity of cpus memory and disk it will take a while let me wait a bit virtual machine was created and now i see message preparing kubernetes on docker and it means that by default we will utilize docker container runtime for running actual containers inside of the kubernetes cluster here i see step generating certificates and keys booting up control plane and finally at the end i see done cubectl is now configured to use minicube cluster and that means that you don't need to do anything in order to connect from cubectl to actual minicube cluster this connection was created automatically for you during creation of the minicube cluster also in my case i see such a warning you have selected virtualbox driver but there are better options for better performance and support consider using a different driver hyperkit parallels or vmware now let's actually verify status of this kubernetes cluster and for that you could enter command mini cube status and you should find out that host is running cubelet is running api server is running and cubeconfig is configured that's normal status of the mini cube cluster and now we are actually able to create deployments services etc inside of this mini cube cluster also i would like to mention that i don't have docker running right now i actually have it installed on this computer but over here in the icons bar i don't see docker icon it means that now kubernetes on my local computer does not utilize actual docker installation on my computer but there is a docker which is running inside of the mini cube node and that's what we will check right now so as you already know each node in the kubernetes cluster is just server either virtual or physical in our case we have created virtual server and you could connect to any server by using ssh protocol and in order to connect via ssh we first need to find out which ip address was assigned to kubernetes node minicube provides command for that simply type minicube ip and you'll see which ip address was assigned to virtual machine which is running our kubernetes node which was created by minicube here is ap address in my case simply grab this ip address and afterwards type ssh docker it is username which is default username for such a node such virtual server and after add sign paste ap address of minicube node and afterwards please press enter you will be presented with fingerprint please go ahead and type here yes we trust such a fingerprint and afterwards you will be prompted for password default password for minicube virtual machine is tc user please go ahead and type it here so username is docker and password is dc user password was entered and now i see welcome prompt from the minicube server now i am inside of the kubernetes node and first command which i would like to ask you to enter here is docker ps such command will list you all running docker containers and here a bunch of different containers which were created inside of the kubernetes node and again please recap that docker is default container runtime for kubernetes there are other container runtimes such as crio and container d but here we see that there are a bunch of different containers which were created by docker inside of the mini cube node and for instance here i see such container as cube api server cube scheduler and so on recap that we discussed with you different services which are running on master nodes and worker nodes and those services are actually running inside of the containers as you see right now here also there are such containers as the cube proxy storage provisioner or for instance core dns and again every container has its own purpose that's how you could verify which containers were created inside of the kubernetes node but if i enter here cube ctl command i'll see error cube ctl command not found because cubectl command is not available inside of the kubernetes node cubectl is external tool which is used in order to manage kubernetes cluster that's why let's now go out of this ssh connection connection was closed and now let's utilize cubectl command here of course cubectl is available locally on our computers because we have installed cubectl before let's first check clusterinfo cluster dash info and i get following output kubernetes control plane is running and here i see ip address which we just saw after entering mini cube ip command in your case of course such ep address will be different and also i see that core dns service is running as well it means that now we are able actually to create deployments services etc on our kubernetes cluster but first let's list nodes which are available in our kubernetes cluster for that please enter command cube ctl get nodes and here i see just single note because minicube creates single node cluster here is name of such node status is ready and here are roles control plane and master recap that now inside of our mini cube cluster this single node acts both as master node and worker node and on worker node kubernetes creates different ports related to your deployments which you deploy in kubernetes cluster now let me check which ports are available right now in this cluster for that let's enter command cube ctl get ports and now i see output no resources found in default namespace let's list all namespaces which are available now in this kubernetes cluster for that please enter command cube ctl get name spaces like that and i see several namespaces like default cube node list cube public and cube system namespaces are used in kubernetes in order to group different resources and configuration objects and if you enter simply cube ctl get ports you will see only ports available inside of the default namespace here and by the way all pods which we'll create throughout this course will be created in default namespace but we have not yet created any pods so far that's why let's try to find out which ports are running inside of other namespaces for instance cube system in order to list ports in specific namespace you have to utilize namespace option so cubectl dash getpods name space equal sign and here enter cube system let's go ahead and run this command and now here in this namespace cube system i see such pods as core dns etcd which stores logs of entire kubernetes cluster cube api server cube controller cube proxy cube scheduler and storage provisioner all those spots are system pods which are running on this master node all right that's how we could find out which ports are running right now in our kubernetes cluster now let's go ahead and create port manually and for that we could utilize command which is similar to docker run command but with docker run command you could create just single docker container here you could utilize cube ctl run command in order to create just single port let's do that cube ctl run here will be named let's for instance utilize nginx docker image which is available at docker hub for that let's enter here name of the port nginx and afterwards let's add option image and its value will be nginx nginx here is name of the docker image which will be pulled automatically and new container will be created based on this image and this container will be running inside of the kubernetes port let's go ahead and see what will happen cube ctl run nginx dash dash image equal sign nginx and here i see output port nginx created let's enter command cube ctl get put and here i see now single port nginx it is not yet ready and its status is container creating let's enter same command again cubectl getpods and now i see that this port is now running it is ready and its status is running of course it took some time in order to create such a port because inside of it there was engineers container and docker inside of the kubernetes node was actually requested to pull nginx image from docker hub and create corresponding container based on such image nginx let's now find out the tails of this specific port with name nginx this name we specified manually here for that please enter command cube ctl describe port and here will be name of the port which you would like to describe get details about here will be nginx it is name of the running pot and here are many different details related to this specific pot let me scroll a bit up and here i'll find out such information as namespace this port belongs to and it was automatically assigned to default namespace that's why we were able to see it in the list when we entered command cubectl getpods because such command lists all posts inside of the default namespace here is information about node where such specific port was created recap that kubernetes automatically distributes load across all nodes worker nodes inside of the cluster and it selects specific node for specific port and that's information about the node where this particular port was created in our single node cluster of course you will see the same node each time when you create any port and here is ip address of such node here is start time here are labels status is running and here is ap address which was assigned to this particular port 172 1703 but please note that now we will not be able to connect to this particular port using such internal ip address of the port in order to be able to connect to ports you have to create services in kubernetes and that's what we will look at a bit later here below you could also find out which containers were created inside of this spot and there was just single container here is id of such container here is long id here is image which was utilized for this particular container and that's that image which we specified using dash dash image option when we created new port here is image id and it is id of the image from the docker hub because by default kubernetes pulls all images from the docker hub of course it's possible to configure kubernetes to pull images from other repository hosting services but default is docker hub all right these are details about this particular port and we find out that there is ip address assigned to this port there is container which was created inside of this port and here are logs related to creation of this particular port you see that this particular port was successfully assigned to mini cube node here is message about pulling image nginx from the docker hub successfully pulled image created container nginx and started container nginx and it means that now there is nginx container running inside of the created port again you could find the list of all ports by entering command cube ctl get ports and here is single port available right now in the default namespace now let's quickly go back again inside of the kubernetes mini cube node and list again docker containers and we will find out that now there is one more container which was created in the nginx spot so using up arrow i could go back to the ssh command which i entered before here it is and connect to this node again enter tc user password and let's enter here a docker ps but now let's filter output by name nginx and now i'll find out that there are two different containers here is first one and heroes second one which are related to nginx here is the name of the first container k8s ngnx nginx default and so on and also there is one more container k8s port nginx default and so on and this second container is called pause container here you see that inside of the container pause executable was actually launched when container was created and if docker is a container runtime in kubernetes there are always such pos containers which are created for each specific port and such post containers are created in order to let's say lock namespace of specific port and we discussed before that all containers inside of the same port actually share namespaces and this container which is actually running our nginx web server could be stopped could be recreated by kubernetes but port remains untouched and this second container which is called pos container is required to keep name space of the pot all right that's how containers look right now and let's actually connect to this container where we are running nginx service in order to connect to container you could use either id this one or this name let's connect to container by this id please select this container not post container and let's enter command docker exec id here is id of the container and let's connect this container using sha executable now i am inside of the container let's check its host name nginx it is name of the pod actually and same name was assigned to this container and let's also check ip address of this container here is such iep address 172 1703 and that's that ap address which we saw in the details of the port now let's try to connect web server which is running inside of this container where we are currently in by using this ip address and for that we could utilize c url command and here a paste ap address of this particular container recap that we are inside of the nginx container let's try to make connection and here i see welcome to nginx page which was returned by this web server it means that nginx web server is up and running let's go out of this container and now we are still inside of the kubernetes node okay that we made ssh connection to it and now let's exit from this connection as well like that and now let's enter following command cube ctl get pods dash all white and with such option you'll find also ip address of particular port in this output and here is the same ip address which we just saw inside of the container let's now try to connect to such ep address from our computer our computer is external relative to our kubernetes cluster because kubernetes node is running inside of the virtual machine and this ip address was assigned by docker to particular container inside of the node let's try to connect to such ap address i could utilize the same command c url here it is available on mac or you could simply open up web browser and connect to this ap address and you'll find out that you will not be able to connect to nginx container like that because as i told you before such ip address is internally addressed of the port and you are not able to connect to such port from outside world outside of the cluster great that's how we created very first port in our kubernetes cluster and we also explored the tails of such port and i hope that now it is clear to you what happens when you create a port inside of the port kubernetes creates a container and in order to create container it has to pull image from the docker hub and in our example nginx image was pulled and new container was created based on that image also we went inside of the container and verified that nginx web server is now actually running but we are not able to connect to such port from the outside because now it has only internal ip address which was assigned by the docker but of course creation of the ports using cube ctl run command is not really convenient because you are not able to scale and for example increase quantity of the pots there is just single pot which we created using cube ctl run command that's right now let's simply delete created port for that there is command cube ctl delete next will be name of the resource we would like to delete and it is spot and here will be name of the port in our example nginx because we specified such name for the port manually when we entered cubectl run command so let's go ahead and delete such a port port nginx deleted cubectl getpods and there are no resources found in default namespace and such port is simply gone and all volumes all namespaces related to this particular port were removed great you might notice that we entered cubectl command multiple times and in my opinion such command is relatively long and we are able to create alias for such command in order to save some time in the future and we could alias cubectl command to just a single letter k and afterwards we will enter such commands as k getport but now if i enter such command i'll get the command not found error because i have not yet created any aliases on linux like operating systems you could very easily create alias by entering command alias next will be alias for the command then equal sign and after equal sign in double quotes you could write command which you would like to alias in our example cube ctl if you are a windows user and if you are using powershell this command will not work there if you want to get similar to mine experience in command line i recommend to you to install git bash in order to install it please navigate to git scm-com and simply download git if git is already installed on your windows computer you already have access to git bash it is another terminal if you don't have git installed please go to windows section here and download git for windows here are different links to it and after installation please open git bash terminal instead of the powershell so i already have alias command available in this terminal on my course therefore i will be able to create such an alias let's create alias alias was created and now i'm able to utilize just short version of the command k get bots and now i see output no resources found in default namespace from this point on i will utilize such short version of the cubectl command but please notice that such alias will live only during this session in the terminal after a lot of the computer or when you open up another terminal session this alias will be gone if you would like to create a permanent alias of course it is possible to do in order to perform such a task you have to edit your shell configuration profile but i will not do that right now it's enough to have just temporal alias great now let's continue as i mentioned before it is not convenient to create separate ports inside of the kubernetes cluster because you are not able to scale and increase quantity of the pots therefore the most common way to create multiple posts when you are able to increase quantity of the ports decrease quantity modify configuration etc is by using deployments and deployment will be responsible for creation of the actual ports but please notice that all ports inside of the deployment will be the same exactly the same but you could create multiple copies of the same port and distribute load across different nodes in the kubernetes cluster that's purpose of the deployment now let's go ahead and create deployment and we will utilize same image which we utilized before it is nginx image and also afterwards we will increase quantity of the ports in this deployment and also we will create a service for this deployment in order to be able to connect to our deployment from external world let's go ahead and create such deployment and for that we will utilize command cubectl create deployment we already aliased the cubectl command that's why i will enter k create deployment and next will be name of the deployment let's name it nginx and afterwards let's specify also image similarly as we did in cubectl run command and here after equal sign will be name of the image we would like to utilize for this deployment and let's enter here nginx in order to avoid any confusion let's modify name of this deployment and let's name it for instance nginx dash deployment like that let's go ahead and create this deployment deployment was created let's enter command k get deployments here is single deployment it is ready and up to date and let's enter k get pots and now i see that there is no single port which is managed by this particular deployment and such a port was created automatically after we created such deployment and now this spot is managed by this deployment there is just single port at the moment and of course it is possible to scale quantity of the pots and increase quantity of the pots for instance to 3 5 and so on but first before doing that let's read details about size deployment and for that let's enter command k describe deployment and here will be name of the deployment nginx deployment here are details of created deployment let's scroll a bit up and here at the beginning of the output i see name of the deployment nginx deployment that's that name which was given to this deployment by us here is namespace where such deployment was created default namespace below you'll see that kubernetes automatically assigned labels to this particular deployment and there was just single label up equal assign nginx deployment also there are annotations again created automatically here is annotation and here is also selector selectors are used in order to connect ports with deployments because in kubernetes ports and deployments are actually separate objects and we have to know how to assign specific ports to particular deployments and here we see selector up equal sign nginx deployment and for a particular port which was automatically created and assigned to this deployment we will find a label with the same value up equal sign nginx deployment we will have a look at that just in a minute also there is replicas field and here you could find information about quantity of the pods which are desired by this deployment and the actual quantity of the ports which are running here is just single port single replica which is desired one updated one total and one available it means that now there is one port which is assigned to this deployment here is also strategy type rolling update which tells how to perform updates of the deployments we will get back to it a bit later in this course and also below you'll find other details about this particular deployment here you'll find also details about port template and as i just told you you'll find out inside of the port corresponding label up equal sign nginx deployment and same label is mentioned here in the selector field in the deployment and that's how deployment is connected to particular ports also if you scroll a bit down you'll find actual events related to this particular deployment and here we see single event scaling replica set but what is replica set a bit above you see new replica set nginx deployment and id of the replica set and replica set actually manages all ports related to deployment and replica set is a set of replicas of your application because you could create 5 10 100 different ports in the same deployment and all of them are included in the replica set and that's why here you see that such replica set was scaled up to one and one port was created in this replica set great these are details about this particular deployment and now let's have a look again at the list of the pods k get pods here is just single port and notice its name it starts with the name of the replica set which we just discussed and saw in the output of the details of the deployment nginx deployment and this hash and afterwards there was specific hash for this particular report and if there are multiple ports in the same deployment which belong to the same replica set you'll see same prefix here but different hashes here for different ports now there is just single port which is ready and which is running also we could get details about this particular pot let's grab its name and enter here k describe port and here let's paste copied hash and here are details about this particular report let's scroll up here is name of the port it matches with this name it was assigned to default namespace same as deployment here is note where this particular port is running right now here are labels of this particular port and i see such label as up nginx deployment and port template hash notice that this hash is equal to this hash and it matches with id of the replica set also i see status running here is ip address of the port and here i see that it is controlled by specific replica set replica set nginx deployment and heroes hash of the replica set which controls this particular pot also here are details about containers which are running inside of the port and here is container id and image which was used for creation of the container in this particular port also at the end you could find the logs related to the port as we discussed before successfully assigned to specific node pulling image nginx and so on now there is deployment and instead of the deployment there is replica set and ports are managed by this deployment now there is just single pot great now let's try to scale this deployment and increase quantity of the ports inside of the deployment now there is just single port for that we could utilize following command cube ctl shortly k in our case scale we would like to scale deployment let's write here deployment name of the deployment in our case is nginx-deployment and afterwards let's specify quantity of the replicas we would like to have in this deployment right now now there is just single replica in order to specify desired quantity of the replicas we could add here option replicas and after equal sign specify quantity of the replicas let's say we want to scale to 5 replicas let's enter 5 here and let's scale our deployment deployment was scaled and now let's enter command k get bots and i see that there are four new containers which are currently being created here is one put second third and fourth port and this port is still running in a moment you should see that all five ports will be running here they are we ju
Original Description
Learn how to use Kubernetes in this complete course. Kubernetes makes it possible to containerize applications and simplifies app deployment to production.
✏️ Course developed by Bogdan Stashchuk. Check out his channel: https://www.youtube.com/c/CodingTutorials
⭐️ Course Contents ⭐️
⌨️ (0:00:00) Kubernetes for Beginners Introduction
⌨️ (0:02:40) What is Kubernetes
⌨️ (0:06:46) What is Pod
⌨️ (0:08:22) Kubernetes Cluster and Nodes
⌨️ (0:10:40) Kubernetes Services
⌨️ (0:14:17) What is kubectl
⌨️ (0:17:23) Software required for this course
⌨️ (0:21:49) Installing kubectl
⌨️ (0:25:03) Installing Minikube
⌨️ (0:29:38) Cleating Kubernetes cluster using Minikube
⌨️ (0:33:50) Exploring the Kubernetes node
⌨️ (0:40:36) Creating just single Pod
⌨️ (0:45:57) Exploring Kubernetes Pod
⌨️ (0:52:44) Creating alias for the kubectl command
⌨️ (0:55:17) Creating and exploring Deployment
⌨️ (1:07:00) Connecting to one of the Pods using its IP address
⌨️ (1:09:23) What is Service
⌨️ (1:11:18) Creating and exploring ClusterIP Service
⌨️ (1:16:38) Connecting to the Deployment using ClusterIP Service
⌨️ (1:20:55) Deleting Deployment and Service
⌨️ (1:22:20) Creating Node web application
⌨️ (1:30:05) Dockerizing Node application
⌨️ (1:38:28) Pushing custom image to the Docker Hub
⌨️ (1:40:26) Creating deployment based on the custom Docker image
⌨️ (1:45:49) Scaling custom image deployment
⌨️ (1:49:14) Creating NodePort Service
⌨️ (1:53:51) Creating LoadBalancer Service
⌨️ (1:56:49) Rolling update of the deployment
⌨️ (2:05:30) What happens when one of the pods is deleted
⌨️ (2:06:31) Kubernetes Dashboard
⌨️ (2:10:49) Creating YAML deployment specification file
⌨️ (2:17:04) How to use Kubernetes documentation
⌨️ (2:20:35) Applying YAML deployment file
⌨️ (2:24:13) Creating YAML service specification file
⌨️ (2:27:59) Plan for the creation of the two deployments
⌨️ (2:31:16) Creating another web app with two endpoints
⌨️ (2:35:15) Building custom Docker image for the second web app
⌨️ (2:
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from freeCodeCamp.org · freeCodeCamp.org · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
React: Production Server Setup Part 2 - Live Coding with Jesse
freeCodeCamp.org
cookies vs localStorage vs sessionStorage - Beau teaches JavaScript
freeCodeCamp.org
Browser history tutorial - Beau teaches JavaScript
freeCodeCamp.org
Graph Data Structure Intro (inc. adjacency list, adjacency matrix, incidence matrix)
freeCodeCamp.org
React: Parameterized Routing with Next.js - Live Coding with Jesse
freeCodeCamp.org
React: Dealing with jQuery Issues - Live Coding with Jesse
freeCodeCamp.org
setInterval and setTimeout: timing events - Beau teaches JavaScript
freeCodeCamp.org
Browser and Device Testing - Live Coding with Jesse
freeCodeCamp.org
Last Minute Updates - Live Coding with Jesse
freeCodeCamp.org
Post Launch Updates - Live Coding with Jesse
freeCodeCamp.org
React: Setting Up Google Analytics - Live Coding with Jesse
freeCodeCamp.org
React: Masonry Layout - Live Coding with Jesse
freeCodeCamp.org
Load Balancing Digital Ocean Droplets - Live Coding with Jesse
freeCodeCamp.org
try, catch, finally, throw - error handling in JavaScript
freeCodeCamp.org
Load Balancing: SSL Passthrough Setup - Live Coding with Jesse
freeCodeCamp.org
Graphs: breadth-first search - Beau teaches JavaScript
freeCodeCamp.org
React: Masonry Layout Part 2 - Live Coding with Jesse
freeCodeCamp.org
React: WordPress API Live Search - Live Coding with Jesse
freeCodeCamp.org
Creating WordPress Custom Post Types - Live Coding With Jesse
freeCodeCamp.org
Dates - Beau teaches JavaScript
freeCodeCamp.org
Miscellaneous Front End Updates - Live Coding with Jesse
freeCodeCamp.org
Merging a Pull Request from GitHub - Live Coding with Jesse
freeCodeCamp.org
React + Prettier + Standard JS - Live Coding with Jesse
freeCodeCamp.org
React: Sortable Responsive Table - Live Coding with Jesse
freeCodeCamp.org
Geolocation Sorting by Distance - Live Coding with Jesse
freeCodeCamp.org
Tradeoff Matrix - Agile Software Development
freeCodeCamp.org
The Definition of Ready - Agile Software Development
freeCodeCamp.org
Getting first React job without experience - Ask Preethi
freeCodeCamp.org
React: Google Analytics Click Tracking - Live Coding with Jesse
freeCodeCamp.org
Submitting a PR to an Open Source Project - Live Coding with Jesse
freeCodeCamp.org
Should I go back to school to get CS degree? - Ask Preethi
freeCodeCamp.org
Hero Section CSS Changes - Live Coding with Jesse
freeCodeCamp.org
Working Agreement - Agile Software Development
freeCodeCamp.org
A day at Pennybox with Co-Founder Reji Eapen
freeCodeCamp.org
React: Sorting and Filtering Data - Live Coding with Jesse
freeCodeCamp.org
React: Sorting and Filtering Data Part 2 - Live Coding with Jesse
freeCodeCamp.org
React: Building a New UI - Live Coding with Jesse
freeCodeCamp.org
Definition of Done - Agile Software Development
freeCodeCamp.org
Getting started with jQuery (tutorial) - Beau teaches JavaScript
freeCodeCamp.org
Making a React Blog with WordPress Content - Live Coding with Jesse
freeCodeCamp.org
React, NextJS, CSS - Live Coding with Jesse
freeCodeCamp.org
jQuery events - Beau teaches JavaScript
freeCodeCamp.org
React/NextJS Routing and WordPress API Custom Types - Live Coding with Jesse
freeCodeCamp.org
React: Working with API Data - Live Coding with Jesse
freeCodeCamp.org
React: Refactoring Components - Live Streaming with Jesse
freeCodeCamp.org
jQuery effects - Beau teaches JavaScript
freeCodeCamp.org
More React Refactoring - Live Coding with Jesse
freeCodeCamp.org
animate in jQuery - Beau teaches JavaScript
freeCodeCamp.org
"Finishing" My React Site - Live Coding with Jesse
freeCodeCamp.org
Starting a New React Project (P2D1) - Live Coding with Jesse
freeCodeCamp.org
React Project 2 Day 2: Learning Material UI - Live Coding with Jesse
freeCodeCamp.org
The Agile Manifesto - Agile Software Development
freeCodeCamp.org
jQuery: get and set with http, text, val, and attr - Beau teaches JavaScript
freeCodeCamp.org
React Project 2 Day 3 - Live Coding with Jesse
freeCodeCamp.org
The INVEST approach to product backlog items
freeCodeCamp.org
React Project 2 Day 4 - Live Coding with Jesse
freeCodeCamp.org
Chickens and Pigs - Agile Software Development
freeCodeCamp.org
React Project 2 Day 5 - Live Coding with Jesse
freeCodeCamp.org
jQuery: add and remove DOM elements - Beau teaches JavaScript
freeCodeCamp.org
React Project 2 Day 6 - Live Coding with Jesse
freeCodeCamp.org
More on: Distributed Systems
View skill →Related Reads
📰
📰
📰
📰
Automating Spring Boot Deployments: A CI/CD Pipeline with GitHub Actions and AWS ECS
Medium · DevOps
I Caught a Dev Tool Stealing My Data — So I Built 7 Alternatives That Make Zero Network Calls
Dev.to · SRINIVAS ESLAWATH
The Archaeology of Git Blame: Why AI Doesn’t Understand the Panic Behind Your Code
Dev.to · Bhavnish
Deploying and Configuring Apache on a RHEL/CentOS Server
Medium · DevOps
🎓
Tutor Explanation
DeepCamp AI