A quick introduction about myself
Hey there, I'm Lars, a 23-year-old software developer with a keen interest in DevOps. And let's be honest, in 2023 when you say "DevOps," you're essentially saying "Kubernetes". I'm a firm believer in the "learn by doing" approach. Stumble, fall, but remember: each misstep is a lesson in disguise.
So, here's the deal. I'm diving headfirst into Kubernetes, despite facing two key challenges:
- Running Kubernetes locally is not rewarding enough.
- I like to keep my monthly costs predictable.
Given these constraints, I've decided to roll out my own Kubernetes server. Spoiler alert: I'm a Kubernetes newbie. So, don't treat this guide as a perfect "How to setup Kubernetes", but rather as an open invitation to join my Kubernetes journey.
The Setup
What I'm Working With:
- Transip's most budget-friendly Performance VPS: Check it out here
- Ubuntu 22.04 (Pre-installed, so that's a win)
Let's Roll Up Our Sleeves
Enough chit-chat, let's get our hands dirty. Here's a rundown of the commands I threw in my terminal.😎
I decided to roll with k3s as my base. I did start with Minukube at first, since it's praised as the easiest to start with. However k3s is made by Rancher, so that is an easier combination (I guess).
Installing k3s is simple:
curl -sfL https://get.k3s.io | sh -
Check the node's status:
sudo k3s kubectl get node
Download kubectl (A Kubernetes command line tool)
curl -LO https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl
Install kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
Verify installation by checking the version
kubectl version --client
Copy k3s config
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
Install Helm (The npm of Kubernetes)
sudo snap install helm --classic
If snap is unavailable please follow the Helm installation guide (https://helm.sh/docs/intro/install/)
Add Rancher stable repo
helm repo add rancher-stable https://releases.rancher.com/server-charts/stable
Create cattle-system namespace for Rancher
kubectl create namespace cattle-system
Install Cert Manager CRDs
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.1/cert-manager.crds.yaml
Create cert-manager namespace
kubectl create namespace cert-manager
Add jetstack Helm repo and update
helm repo add jetstack https://charts.jetstack.io
helm repo update
Install cert-manager
helm install cert-manager jetstack/cert-manager --namespace cert-manager --version v1.13.1
Check cert-manager pods and wait till they are ready
kubectl get pods --namespace cert-manager
We need to install an older version on k3s because Rancher is not able to support the latest k3s yet:
wget https://github.com/k3s-io/k3s/releases/download/v1.26.6%2Bk3s1/k3s
Move this older version of the k3s binary
sudo cp k3s /usr/local/bin/k3s
Restart k3s
sudo systemctl restart k3s
Verify node status again
kubectl get nodes
🥳 Install Rancher 🥳
Please ensure you use the correct domain and email. The domain already needs to point to the server on install. If not, the LetsEncrypt verification will fail and your server will not receive a valid ssl certificate.
helm install rancher rancher-stable/rancher
--namespace cattle-system
--set hostname=rancher.yourdomain.com
--set bootstrapPassword=admin
--set ingress.tls.source=letsEncrypt
--set letsEncrypt.email=youremail@email.com
--set letsEncrypt.ingress.class=traefik
That's it! You should now be able to visit rancher.yourdomain.com and setup the application. Please note that the default password is set as "admin" (unless you changes the bootstrapPassword in the install command).
Next up: Creating a second node and connecting it 🚀
To be continued in a new post...
Top comments (0)