Rancher (Why and Why not)
Howdy! In this month’s post I wanted to talk about Rancher. I know there are already a lot of guides on this so I wanted to explain not only how to install Rancher but also what it is and why you would want to use this and when you wouldn’t.
Why?
If you are just starting to get into Kubernetes and containerization, Rancher can be a great tool for you. It strikes the incredible balance of making a lot of things easy and streamlined for you without hiding the advanced configuration options and details. This makes learning and using Kubernetes really easy with Rancher. It can be a little intimidating to deploy something when you just barely stood up your cluster so using Rancher can help you get stood up quickly. Rancher also doesn’t use and proprietary APIs or libraries when it performs actions. Its all the same tools you would use if you were doing this with CLI. On top of all this, Rancher adds a lot of visualization to what is happening inside your clusters and their health. Rancher even has its own repository of charts that come preconfigured for use with Rancher for things like reverse proxies, monitoring, alerting, distributed storage, and more.
Why Not?
Rancher is a fantastic tool to get started like I said, however it makes things so easy that it might become hard in the future to do anything without it. This can come back to hurt you when you look for a guide or are trying to do something in an environment that doesn’t have Rancher. Learning kubectl and the different parts of Kubernetes is absolutely critical even if you use Rancher. **Rancher is meant to add value to your existing tool set. Not replace it. **So if you understand this and want to get started with Rancher, see below!
Steps:
We’re going to get you started by getting you a certificate to use with Rancher (SSL is always a good idea), then actually install Rancher.
- Make sure you have helm installed
- Install cert manager:
1 2 3 4 5 6 7
https://github.com/jetstack/cert-manager/releases/download/v1.3.1/cert-manager.crds.yaml kubectl create namespace cert-manager helm repo add jetstack https://charts.jetstack.io helm repo update helm install cert-manager jetstack/cert-manager \ --namespace cert-manager \ --version v1.3.1
- Install Rancher and expose the deployment so you can get to it. Make sure to set the hostname to whatever you’re going to use to connect to Rancher. For example,
rancher.local
or if you’re going to expose this on your domain (which I wouldn’t advise) then something likerancher.my.domain
.1 2 3 4 5
helm install rancher rancher-latest/rancher \ --namespace cattle-system \ --set hostname=rancher.my.domain kubectl -n cattle-system rollout status deploy/rancher kubectl expose deployment rancher -n cattle-system --type=LoadBalancer --name=rancher-lb --port=443
That’s it! It is really that simple. Now when you go to the IP of the loadbalancer that was created, you’ll be greeted with a screen to set up a master account. After you set that up, you’ll be able to see you “local” cluster which is your k3s kubernetes cluster! Congrats!
The next step is to install a reverse proxy and then add port forwarding on your router to the static IP for your proxy and start making your deployments accessible to the internet. We’ll cover that next time.