0:00
In order to install Rancher on our cluster we need to tell Kubernetes about Rancher and we do
0:05
this using Helm which is the tool that we initialized in the previous video. Now Helm is the package
0:10
manager for Kubernetes and Rancher is a package. We need to add the Helm chart repository for releases
0:16
of Rancher. Now you can go with whichever tag that you like. I would recommend stable for a
0:21
production environment but because we're doing this in a demo environment I'm going with latest
0:25
to keep the process in line with what we've done throughout the rest of this project i'm going to
0:30
create myself a shell script for installing rancher and put all the commands that are relevant to that
0:34
process in there the initial entry in that file is going to be to add the helm chart for whichever
0:40
version of rancher you wish to install and because i've created that file outside of vs code i have
0:45
to close and reopen the directory to refresh the contents the shell script is really straightforward
0:51
we start off with the shebang as normal, add in our line that we've taken directly from the ranch docs
0:57
and just change it slightly to be compatible with our makefile command Nothing new at this stage Now it might be nice to extract out what version of the helm chart we wish to install and put that inside its own variable this would make it easier for if you
1:13
got different environments or whatever you want to reuse this script in some way you don't need to
1:18
do this step it's just a nice to have at this stage you could either add that to your make file as
1:23
we've done in previous examples or you can just run it directly from the command line as i'm about
1:28
to do here rancher server 2 is designed to be secure by default now this is different from the
1:33
original rancher which would just allow you to run over http so there's three options for ssl
1:39
configuration everyone's needs are different so i'm not going to tell you which to go with but i'm
1:44
opting for let's encrypt and that means that we need to install cert manager all this means for us
1:49
is we need to take a copy paste of something from the documentation paste it into our shell script
1:54
and update appropriately to use our makefile command it's so nice when we put in all the hard
2:00
work up front and towards the end of a project everything starts to come together really quickly
2:05
i really like that again unnecessary but i going to extract out the version into its own variable just makes it easier to update scripts and stuff over time without having to dig through all the config especially as your shell scripts get longer
2:19
Again, unnecessary, you don't need to do this step. In short, CertManager is going to ensure
2:24
that all our certificates are kept up to date periodically. This is useful as our certificates are generated by a third party
2:31
that's Let's Encrypt, so it'd be nice that we don't have to manage that process
2:34
Lastly, we need to add the entry for installing Rancher, and in our case, the appropriate flags to make use of Let's Encrypt for handling TLS
2:43
You're going to need to change the hostname and also the Let's Encrypt email field to whatever you're using, and these need to be valid
2:49
Now, in my opinion, these two aren't really worth extracting out into variables, as it's very unlikely that I'm ever going to change these anytime soon
2:57
So hardcoding these, in my opinion, is fine, but of course, feel free to change it up for your installation
3:02
There is an extra flag which I would suggest setting the first time at least that you're going to run this command and that's to set Let's Encrypt's environment to staging
3:12
So there two different environments for Let Encrypt There staging and there production Production would be the default But if your configuration is incorrect in any way let encrypt in production mode will very quickly block you
3:25
and put you on quite a long time out if your request fails consecutively so for example if
3:31
your host is not resolving properly maybe you've made a typo or something like that then this can
3:37
add hours to your setup time so start off with staging which is a lot more lenient then when
3:42
you've ensured that your setup is good come back and either remove that line or set it explicitly
3:47
to production with all that done if we rerun our shell script we should now be able to connect to
3:53
rancher for the first time and start the installation process at this stage you have
3:57
the beginnings of a rancher 2 managed kubernetes ha cluster now as mentioned several times throughout
4:03
this tutorial series this should be considered a basic starting point not a production ready
4:09
cluster. This is ideal for learning and practicing and potentially for people who are interested in
4:14
self-hosting. If you're interested in a continuation of this series from this point onwards
4:19
then do let me know in the comments section below and I hope you've enjoyed this course