How to host Kubernetes Helm chart on public repo using GitHub Pages | Create public helm chart repo

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone my name is vivek i am a software engineer i make videos about kubernetes containers and and related technologies and and sometimes about about software engineering in general so in some of the previous videos we actually looked into how we can create a helm chart for our application and in this particular video we are going to look into how we can host that particular helm chart onto a public repo so that others who want to use our application can actually try to deploy it using using helen right so this is the application that we were working on and we also raised appear on this this github repository that we have and from last video what i have done is i just have merged this particular pr so this pr was about creating the helm chart for your application and i have i have created i have made another video about that so if you want to check that out maybe you should you should check that out as well so what we have now is we have our library application as we can see here we have our our library application and we also have helm chart created for that application and everything related to help chart is inside this particular directory that is help right and in this particular video we are actually going to look into how we can host this particular help chart onto a public repository public help repository so that others can actually install it so for example if we have if we have published our application using a public health repo if someone wants to install it all they have to do is first step they will have to add the repo right so that help would be able to figure out the applications that are hosted on that that reaper so for example if you have your application hosted on a specific repo so for example let's say dot xyz slash let's say uh library slash charts if your applications are if your helm applications are hosted here you will have to add this helm reaper using using help repo ad then name of the repo and then then the end point that we have here right so this is what we are going to do we are going to create a public help repo using github pages and then we are actually going to publish our chart in in that repo so that anyone can actually try to or or anyone can actually install the application that we have right so as we have discussed in in the previous videos uh the the all the details uh all the manifests that are supposed to be deployed as part of your help chart would be inside this particular directory that is help uh i would like to say that if you are not familiar with the directory structure of a helm chart uh you you should i i recommend you checking my previous videos out so now that we have created a helm chart for for our application let's just go ahead and try to have a look into this particular directory so this is how the directory looks like right and if we uh now if we talk about a helm repository right so this is how a helm repository looks like so for example you would have a directory named charts and in that directory you would have a manifest file or or metadata file i would say named index.yaml and this index.yaml is going to have details about all the charts that are hosted by this particular repository right so there are chances that so for example let's say if i'm creating this help repository right for my organization and my organization is hosting or let's say publishing n number of applications or n number of helm charts right in that case this chart directory is going to have n number of applications so let's say i'm going to host library and let's say i'm going to host another chart that is nginx right so there are chances that this repo or most of the time all the helm repos are going to host more than one application and details about all these applications is going to be inside index.js right so inside index.yaml uh we would have details on what are all the applications that are that are supported or that are exposed by by this repository and what is what what are their details for example which version of chart we are publishing and things like that right we are actually going to look into this index.yaml uh in very much uh detail in a bit but this is how our typical helm repository structure looks like right so you would have charts directory and then index.aml file and this index.ml file is actually going to have details about uh the the helm applications that are being hosted now if we talk about our specific scenario this is the helm application that we are going to host right and in our last video we actually uh did not we actually uh generated the scaffold code and we did not change a lot of things so let's just go ahead and try to try to refactor that a bit right so first of all the the very first thing that i would like to change here is uh let's name this to library right and a helm chart chart to deploy maybe library application right and all these details are going to be inside the index.aml right and we are going to look into that how how that happens so this is this is the chart version so obviously we are going to have chart goes into 0.1.0 and let's make app version 2 0 dot 0.1 right so now there are chances you might you might get confused between these two so this version is for the help chart version right and this version is for the application that you are hosting or application that you are packaging using this helm chart so in our case this is this is let's say library application version and this is chart version right so now that we have now that we have changed these things let's just go ahead and try to package this particular uh helm chart that we have right and as as we discussed uh in here these particular files are actually tire balls off of the helm help repos so to to actually package a help chart what we can do is we can use another or a utility of help named help pack is right but before that let's just go ahead and try to create another branch so host repo or let's say help repo host right and the reason is we if we look into if we look into this particular code structure that we have or our github repo uh we have everything in our master branch right but we want to host let's say hypothetically we want to host hill repo in another branch we can do that in in master as well but let's but let's just go ahead and try to host that in a new in a new branch that we that we create and in that new branch we are just going to have the the charts directory that we discussed about that we discussed about here right so now hell package or let's just go ahead and try to create a directory named charts right and help package and we want to package we want to package this chart right and into the directory charts and it says okay so i was expecting this file to be generated inside charts so let me just go ahead and try to remove this and i'm going to all right so hyphen d should be provided for the destination so all right health package and the chart is in helm directory and i want this to be generated inside uh inside this charts directory that we have created all right so it says that the chart has successfully been packaged to this particular to this particular directory right now this is this is the chart that we are going to publish to our public health repo right this is the package chart and as you can see this is the this is the chart name and this is this is the chart version right now to actually generate the index.yaml file there is this another utility that help provides so help repo and index and this expects a chart right so we are going to specify the chart that is inside charts directory and now if we cd into charts we can see that this is the application and this is the index file that has been that has been generated now if we just go ahead and try to look into this index file that we have here we can see that this is this is these are all the details that we have specified in the in the applications chart.yeah well as you can see here right so for example this is the description uh this is the app version this is name type and every other thing right now one thing that i would like to discuss about is digest so digest the is is something that you that is used to to verify that one file is same if it is transferred transferred over some places that the contents are same and and it has not been been changed right and to figure out the the digest what you can do is you can actually uh use sha sum command with algorithm 256 and you can specify the file right so we want to generate some for this particular file and this is this should be the file right sorry this should be the sha that is that is mentioned here and if we talk about urls so if someone asks if someone queries this particular this particular help repo so in that particular case and tries to install library this is the chart that is going to be installed right and we can see in in the directory structure the chart is present over here over here right so this is how now all we have to do is we'll have to somehow we will have to somehow host or or publish this particular directory onto a public server right this is all we have to do we have we have a packaged application right and we have index.aml file and we just have to publish them publish them publicly so that user users can add the help repo onto their machine and then then they can install the things now uh to publish this there are a lot of ways for example you can you can you just have to you just need a server that can that can serve static files for example if even it's possible that you can upload these things to your uh public storage buckets and from there the things can be served right but what we are going to do in this particular in this particular video is we are going to use github pages because github pages can also be used to serve static files right so let me just go ahead and try to try to do this do the same thing so what i'm going to do is i'm going to push this okay and when we push this all right so we have successfully pushed the entire thing onto new branch in our in our github repo right so as you can see here if we try to see all the branches we would be able to see the new branch that we just have that which i just have pushed our code into so he'll repo host now all we have to do is we just have to somehow serve this particular charts directory right uh using github pages so to do that to do that let's just go ahead and go to settings and after settings we are going to figure out where do we have github pages and here we have to specify the branch that we want to serve or or we want to we want to host or or publish using github basis so we want to we want to host helm repo host branch right and root directory this is how we can specify the root directory and then if i click on save i would be able to see the url for this particular this particular url for for this particular for this particular repo we can say right and this is the url that we see so now in a way we can say that we have successfully hosted a help repo right so this is the repo that we had locally so in in this inside this particular charts directory we have everything that is needed to create a help repo now we have pushed that into into a branch of this particular github repo that is vivxing library and we have we have made that publicly available using using github pages right so now all we have to do is we have to just add this particular this particular endpoint right using help repo ad right and then we just have to install our application so let's just go ahead and try to do that so henrico ad or let me show you without adding adding the repo so he'll re he'll install and then name of the application let's say library and then we have to specify the repo right and since we have not added the repo so this is the format repo and then chart name right so since we we don't actually have at the repo yet things are not going to work right so let's just go ahead and try to add the repo so help people add name of the people let's name it x right and the end point is going to be this and okay so it says library is not a valid chart repository because we have to specify the the the directory where index.aml is present and index.index.yaml is inside charts directory right and you can see that we have successfully added vbx as as helm depot now if i just go ahead and try to install the things now so help install name of the application then repo repo is vivx and then application name to see the application name uh we can see the index.yaml that is library right and here we go right and if i press enter things would be installed on this particular cluster now one thing i would like to emphasize is we are not installing we are not using local chart now we are installing the things from from a publicly hosted publicly hosted repo and if i press enter all the things that are there uh in in the charts should be installed on this particular cluster and we can see that two two namespaces are just been created database and rest api and if you look into k get pods from database namespace we see that a pod also has been created and if you see pvc from database namespace this would not actually be bound because storage class that we are using is standard and we don't have any storage class name standard in this particular cluster right so let's just go ahead and try to delete the help chart and we are going to install it providing some some custom values right so install and library and hyphen iphone set now uh when we host a helm chart we usually specify all the values that can be set right uh in in a readme or or in a documentation but right now what we can do is we can just go ahead since we developed this particular chart we can go to values and we can specify all the values but we can figure out all the values that can be provided using using hyphen i haven't set flag right so one thing that we can specify is database dot volume dot store is class name so hyphen iphone said database dot volume dot storage class name equals to do hyphen block hyphen store is right because this is the storage class that is present on the cluster and if we press enter here we go so chart has been installed and if we get pvcs from database namespace now we should be able to see that it has been bound because now we have changed the storage class to your blog store is right and this is what we have we discussed about in in uh some of the previous videos that this is the benefit benefit of using using a package management tool right to distribute your application so that if someone wants to install your application they can provide the values uh in in the runtime while installing uh while installing your chart right so yeah i mean as you can see we have successfully hosted our applications using github pages in on a public repo and this can be installed by by anyone if they want to right the other thing that i would like to discuss about is in here we can see that in this particular branch we have a lot of things right so in repo host branch we have a lot of other things for example source code and help chart but all these things are not actually are not actually required we just need charge directory with with index.yaml and all the packages which are packaged charts that we are hosting right now there are chances that if you want to host as we discussed you want to host more than one application home applications in in a repo right and that is what people do all the time right so what you are going to do is you are just going to you are just going to have another packaged helm application in the same directory right and you can use helm repo index with that particular application and respective entries would be made into index data right so if you look into index.html once again you can see that this entries is uh is right now just having library but let's say you want to host another application we have uh we can use help repo index utility to add another entry here to host another chart or another version of the same same application rate and i think we have discussed about almost all the fields uh that we have index.yaml so yeah this this was uh this was pretty much it about creating a public healing repo and publishing your publishing your chart there now the other another thing i would like to discuss about is you can see here if we uh look into this directory from index.aml we are actually referring to this particular tarball right from this is the index.yaml and we are actually referring to the helm application this particular helm application right and it's not necessary that the the application packaged application and index.yaml should be on on the same server or they should be hosted uh together right it's it's not actually a requirement you can you can host this particular this particular packaged application anywhere you want to you just have to specify the url uh absolute fqdn for that particular packaged application uh inside urls right so yeah that is another thing that i would i i just wanted to discuss about so it's not actually necessary that all the packaged applications and and index.yaml are hosted together right index.yaml can be hosted separately and all your applications can be hosted separately right and fqdn of your applications should be mentioned uh for for your urls and if you are trying to add the repository you will have to provide the url where your index.yaml is hosted so that is one thing that that you you can keep in mind right so apart from that yeah i mean this this was pretty much it uh another thing that i would like to discuss about is let's say you have added the repo right and there are chances that another version of the application or another version of the chart has been published to the help repo you can use help repo update to actually update your repo so that newer version of the applications can be installed right so yeah help repo update is another command that i wanted to that i wanted to discuss about uh yeah so this this was pretty easy i think the the main thing is to actually uh spend time figuring out uh what are all the things that you can change well while converting your application into a helm application or into a health chart right what are all the manifests that should be modularized and and every other thing and hosting that is actually an easy part i would say so yeah this was pretty much it if you if you like the video uh maybe you can try to you can consider sharing it uh with your friends your your teammates your colleagues your classmates and yeah thank you so much for watching i'll see you in the next one
Info
Channel: Vivek Singh
Views: 1,307
Rating: undefined out of 5
Keywords:
Id: Xp8gTpSYyRo
Channel Id: undefined
Length: 25min 18sec (1518 seconds)
Published: Sun Dec 27 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.