Package Management with Helm // Kubernetes Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
one of the most annoying things in kubernetes is the complexity of installing applications when you start to work with it and you install a bunch of them you quickly get to a point where it just becomes a mess to control everything in manifests but don't worry in this video i show you an easy way of installing and managing even complex setups and applications in kubernetes by using helm we will install a few example applications like engine x and wordpress but i will also show you how to find new applications you can install and how to customize and manage them but before we do that let me say a few words about today's sponsor of this video teleport which is an open source access proxy to manage your server environment securely you can use it to protect your kubernetes cluster your linux servers your web applications or databases with two-factor authentication and audit logging by using their free community edition completely self-hosted at no cost and suppose you want to use teleport within your company environment and secure your development or operation teams in that case teleport also offers an enterprise version with additional 24 7 support and single sign on it's a great application so just download and try it out you will find a link to their website in the description of this video and so back to helm what exactly is it now and how does it work well the easiest way to describe helm is to be a package manager think of it like an apt or yum command for kubernetes and you can use it to install applications on it manage and update them and of course also remove them i know that's a very simplified explanation but of course it still describes it very well and using a package manager on kubernetes is extremely useful because let's assume you just want to install an application on your kubernetes cluster like my sql database for example then you need to create several objects in kubernetes to make this work so you first of all need a deployment or stateful set that defines your parts and containers then you need a persistent volume to store all the data a secret containing the credentials a config map to store the database configuration files and a service object that defines how the pods can access your application inside and outside of the cluster and that's really just the bare minimum for more complex installations of databases like replication or scaling you might need even more objects and other config files and creating and managing all these objects can become quite hard especially when you define them all in manifest files and here helm tries to take away the burden from us because it defines all these kubernetes resources the application needs in one single template these templates are called charts in helm and you can find them for various applications and deployments and it really is easy as it sounds you just pick a helm chart that you want to use for example a mysql chart and when you install the chart on your kubernetes cluster helm will create all the necessary kubernetes resources that are defined in the chart like the deployment the service object the volumes the config map secrets and so on and this makes it extremely easy to deploy even complex setups of applications that need many of these kubernetes resources so whenever i want to deploy an application on my cluster i always look if there is a helm chart already existing instead of writing all these manifests myself so that sounds pretty awesome but let me get this out of the way helm is not a replacement for kubernetes manifests or cli tools like the cube cdl because even when it's creating all these objects for you you still need to understand what these objects are and how they work so it's still important to have a good understanding of managing kubernetes resources and objects even without help and that's why this video is part of my kubernetes tutorial series you can watch it here on youtube entirely for free by the way but helm should be definitely in your kubernetes tool set so let me walk you through some of the basic commands you need to know let's go okay so if you want to use helm to install applications onto your kubernetes cluster you actually just need two things here so first of all you will need to download the helm package manager and install it on your local workstation so just go to the official homepage helm dot sh and navigate to get started installing helm so this will teach you how to download and install the binaries or how you can use package managers like homebrew for mac os chocolaty for windows or apt or snap for debian ubuntu and other linux distributions and the second thing you will need is you will need a cube cdl that is configured to work with your um kubernetes cluster and you should also take care that you are using the correct namespace because helm will use the exact same configuration settings like the cube ctl command so for example if i have a cube ctl command that is now connected to your kubernetes cluster and your namespace the helm command will just use the same configuration settings if you're following my tutorials you often see that i'm using an alias command for cube cdl and i also created another alias for help that is called h but that will just use the helm command so it's actually just doing the same thing it's just speeding up my workflow so when you install the helm application you can just use the helm command to see what you can do with this package manager there are all the different commands that are available but don't worry i will walk you through all of this so first of all if we now want to install the helm chart on our kubernetes cluster and we want to install an application we should just check that we add some repositories where there are some charts defined so for example you can find them on the official helm documentation when you just go to charts and this will take you to the artifact hub page where you can find install and publish kubernetes packages so you can search for packages you can search for publishers or repositories it's similar organized like the docker hub so for example if you just enter my sequel you will just see all the different charts which match this keyboard here they are all maintained by different publishers in different repositories and one of the most popular repositories i would say is the bitnami repository so bitnami um is made by vmware and they are maintaining a lot of different applications and kubernetes charts here and then you can simply just go to the artifact hub and just um go to the bitnami repository and see all the different charts um you can use and get all the details about them so let's try to do something useful let's first of all connect to my qrs cluster and let's try to install an nginx web server so one of the most common things i usually just demonstrate here in my tutorials and it's very simple first of all you will need to add a repository that deploys an nginx web server so first of all we need to add the bitnabi repository to be able to deploy those charts and you can actually do this by executing the helm command and then execute the command repo add and then you will need to give it a name like bitnami and then use the url of the chart so let's just go to the artifact hub and let's just copy the url of the bitnami repository let's paste it and hit enter you can see that's already existing in my configuration so if you want to check what are the different repositories you have currently installed you can just execute a helm repo ls and that will list all the different repositories you have currently added and you can also search inside these repositories so for example if you want to search for an nginx server you can also use the command helm search and then it gives you two options to search first you can search in the hub so this will just search in the entire artifact hub without using the website or the repo and this will search in the repositories you have added in your local configuration for a specific keyword for example let's just search for the um nginx chart in my repositories that i've added and you can see there is a bitnami nginx chart that we can use to deploy it on our kubernetes cluster so let's just do that once you've added your repository it's very simple to install an application you just enter helm install and give it a project name for example web server and then use the bitnami repository so first of all name the repository bitnami slash and then the chart you want to install so let's just hit enter and you'll see this is now using the cube cdl configuration connecting to my cluster and you can see it's now being deployed you can see it can take some time while the kubernetes resources are created in background and if you want to see what's actually happening on your kubernetes cluster let's just use the cube cdl command to query all the resources in the current namespace and you can see there are a bunch of different objects that helm has installed here for example it has installed two parts here with the web server engine x it has installed a service object so we can access our parts from outside the cluster and it's also installing a daemon set a deployment and a replica set and if we know when to access our web server and kubernetes we simply can just copy this external ip address and open a new tab and yeah let's try to open it and you can see this is now being deployed so that's very very simple so now if you want to check which helm charts you have currently installed on your kubernetes cluster you also can query them so you can also enter helm ls and this will list all the charts that you have currently installed in the current namespace you're using so you can also set a different namespace here with namespace default for example and this will give you a different output here and you can see i have not deployed any helm charts in the default namespace so it's very important if you execute the helm ls command and you're not seeing your helm charts that you check if you are in the correct namespace and you can see we've just deployed one helm chart in the helm test namespace and there's also a revision number we will talk about this in a second and what is the status here and which chart is it using in which app version so you can see it's pretty straightforward to install applications with help most helm charts come with decent default configuration files and settings which will work in most cases but still of course you usually want to customize some of these values or default settings when you deploy those applications in production and here helm gives us the ability to overwrite some of the values which are defined in the chart so what exactly you can change and how these values are used within the chart itself that depends on how the creator of the chart has defined them so that means you should not try to edit these kubernetes objects or manifest manually once helm has installed them but you can change most of the variables in the chart with the value of file you can even change some of these values after the deployment of the chart by updating it however there are some limitations i will show you that in a second so it's better to define all the desired values for the variables before deploying the chart and later just update if it's needed or if you want to install any updates and helm uses a pretty great system to manage existing installations on kubernetes because it always keeps track of the changes so when you want to install a new helm chart on your kubernetes cluster it starts with version one and when you update this chart help increases this version counter if anything fails you can always revert back all the changes to an older version number in helm these are called releases and it's very crucial to understand that to be able to manage the installed charts on your kubernetes cluster so let's take a look at some other charts like a wordpress chart and try to overwrite some of the default values okay so if you want to customize some values inside these deployments you should know which values you want to change so to check that you can just look up the charts in the artifact hub so for example if we want to customize some of the values from our nginx chart you can just click on that to get some detailed information and then you will find a readme file with some instructions um how to use this chart how to install it how to uninstall it and so on and you will also find some resources here so first of all you will find all the templates of the manifests this helm chart is using so when you click on that you can inspect everything that the helm chart is doing so for example when you go to the deployment.yml you will find a deployment object here with all the different values and parameters it will deploy and you can see there are some placeholders for these values this is because there's always a default value that is deployed by helm so to change or override those values you will need to create another yaml file which will define those variables and this will then overwrite the default values so you can also check what are the different values you can customize here by click on that default values and this will give you um usually a long list of all the things you can customize here with some documentation and some readme files to see how you can use it for example let's try to deploy something different for example i want to deploy a wordpress blog on my page of course i want to customize some of the things like the username the um wordpress blog name maybe the email address the administrator account is using and a bunch of other things maybe so let's go and check out a wordpress chart i've not selected the correct one so let's go with the bitnami repository and then we want to inspect the default values file here and you can see there are a bunch of default values i want to change here for example the block name but first of all let's just copy this one here and open it in vs code because then it's a bit easier for me to to see so for example let's search for block and you can see there are a bunch of different values that are defined for the wordpress username for the wordpress password the email address the first name and also the block name and you can change anything in here so let's create another file which is called wordpressvalues.yaml and then we want to customize some of these values you don't need to use this file here you simply can just overwrite what you want to change so for example we just want to overwrite the wordpress username here we want to overwrite the password of course and we also want to overwrite the wordpress blog name here so let's change that give it a password like test1234 just to test something and we will change the username and let's name this to christian's blog so this sounds pretty great so now we want to deploy the helm chart with these specific values so uh let's go back to the terminal and you can see the file is now in my current folder here so i can now execute the command helm install and we now want to install the project wordpress by using the bitnami repository and the wordpress chart and now we want to inject some values here and refer to our wordpress values.yaml file inside my current folder so let's hit enter now so you can see that our wordpress website is now being deployed and this can take some time because wordpress is sometimes really slow but we can just query the status by just query the kubernetes objects and see if our deployments are already running so let's just query it by using the cube cdl commands get all so let's check what is currently deployed you can see the load balancer in the service object and also database are already up and running here but the containers are still panning here so that might take some time here okay so now everything should be up and running so let's just try to access our blog and you can see there is our wordpress blog christian's blog is now up and running that's great let's also test if we can log in with our defined password and this is also working awesome right okay so now i also want to tell you how you can make some updates or changes to your blog because maybe there is a new version of the helm charts um that's being released or you want to upgrade or change anything inside the values here you can also do that but as i said um there is some limitation to that so you can't always customize every value after the deployment some values are forbidden to change afterwards some are just not working for example if you might want to change the value for the wordpress block name so for example let's change this to exit block for example and you might want to do an update now you could assume that this would now change the wordpress block name but that's not the case because some of these values are just used for the initial deployment and also some other values are forbidden to change afterwards so in case of that value here this wouldn't have any effect but there are some values that you can change for example if you have some values that are quota requests for example let's also check in the default values um some of the resource requests here for example some memory requests and we might want to customize that because 512 maybe bytes is not enough we need more memory for our wordpress blog so let's copy this part here of the default values and let's just remove all the unnecessary things we don't want to customize but for example let's change the 512 to 4 gb bytes and let's save these values and now we can upgrade our helm chart to add or change those values here so let's execute a helm ls command again so you can see what is currently installed you can see the wordpress helm chart is now installed in the helm test with the version number or the revision one and now we want to upgrade our helm charts by using the command helm upgrade and then we want to use our project wordpress and we always need to enter all the values that we've used in the initial deployment again so let's enter bitnami wordpress and we also want to enter the values inside our wordpress yaml file so let's hit enter and now you can see that has done some changes so first of all we have changed the revision number from one to two and if we take a look inside the kubernetes objects for example let's just inspect the deployment wordpress here you can see if we scroll down that our resource requests have changed from 512 mb bytes to 4 gb bytes and this is how you can easily use those values files to customize a certain aspect of your helm chart deployments and how you can upgrade them and use revisions and let me also explain what will happen if you made a change that broke anything and you may want to roll back to a previous revision number so you can first of all check all the changes that have been done inside the hem charts by executing the helm history and then use the project name like wordpress and this will give you a list of all the changes you've done and then you can see there are two version numbers because we have upgraded our handshake but maybe we did something wrong and we want to roll back to revision one so just execute the command helm roll back and then use the project name and the revision or the version number you want to roll back to so we want to revert back to version one so what happened now is we reverted all the changes we've done in revision 2 and did a roll back to the reversion one but you know would assume this would have the reversion number one again so this is not the case you can always see that even if you do a roll back it will create a new revision number but it has reverted back to changes so for example if we now check our deployment and scroll down to resources you can see that we now have the memory 512 megabytes again like it was in the revision one so i hope that gave you a good overview of the helm package manager for kubernetes and it's a great solution to simplify the installation of applications it's also worth mentioning that you can create your own helm charts and repositories so i haven't really done this before because most of the applications that i needed to install they were already helm charts existing for and when i needed something very specific i just deployed it with regular manifest files but maybe that would be a topic that interests you so please let me know in the comments if you have used helm before to create your own charts or if you would want to see a video about this in the following videos by the way we will also use hemp to deploy some other applications in my kubernetes cluster for example we will deploy teleport or portena to manage your kubernetes clusters and expose it with ingress controllers so i hope you will enjoy that and thanks everybody for watching i will catch you in the next one bye bye
Info
Channel: The Digital Life
Views: 4,072
Rating: undefined out of 5
Keywords: cloud computing, helm chart, helm charts kubernetes, helm for kubernetes tutorial - part 1, helm kubernetes, helm tutorial, helm tutorial for beginners, helm tutorial kubernetes, how to use helm charts in kubernetes, kubernetes cluster, kubernetes helm, kubernetes helm charts tutorial, kubernetes helm tutorial, kubernetes tutorial, kubernetes tutorial for beginners, learn kubernetes
Id: zka4lJbA-y4
Channel Id: undefined
Length: 20min 11sec (1211 seconds)
Published: Tue Nov 23 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.