2021: the year to move from Docker to Kubernetes

Yup, I’m one of those people that delayed moving my developers, testing, CI/CD and Production off Docker for as long as I could. And now, we’ve gotten all the value we could from Docker, Docker Swarm, Docker Compose, and its time to move on. I’m pretty sure the journey will take most of the year, but Kubernetes has come a long way from the time we first heard of it, sitting in the Docker offices in San Francisco. After working with Darren and the Rancher team for a year, I’m obviously going to start with k3s, add TimescaleDB, and then layer our apps over the top.
sven@x1carbon:~/src$ curl -sfL https://get.k3s.io | sh -
[INFO] Finding release for channel stable
[INFO] Using v1.19.5+k3s2 as release
[INFO] Downloading hash https://github.com/rancher/k3s/releases/download/v1.19.5+k3s2/sha256sum-amd64.txt
[INFO] Downloading binary https://github.com/rancher/k3s/releases/download/v1.19.5+k3s2/k3s
[INFO] Verifying binary download
[INFO] Installing k3s to /usr/local/bin/k3s
[INFO] Creating /usr/local/bin/kubectl symlink to k3s
[INFO] Creating /usr/local/bin/crictl symlink to k3s
[INFO] Skipping /usr/local/bin/ctr symlink to k3s, command exists in PATH at /usr/bin/ctr
[INFO] Creating killall script /usr/local/bin/k3s-killall.sh
[INFO] Creating uninstall script /usr/local/bin/k3s-uninstall.sh
[INFO] env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO] systemd: Creating service file /etc/systemd/system/k3s.service
[INFO] systemd: Enabling k3s unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service.
[INFO] systemd: Starting k3s
sven@x1carbon:~/src$ sudo k3s kubectl get node
NAME STATUS ROLES AGE VERSION
x1carbon Ready master 11m v1.19.5+k3s2
 yup, talk about “it just works” – next time, need to remember the --write-kubeconfig-mode "0644"option 🙂
sven@x1carbon:~$ curl --proto '=https' --tlsv1.2 -sSLf https://tsdb.co/install-tobs-sh |sh

Downloading tobs_0.1.3_Linux_x86_64...
Download complete!

Validating checksum...
Checksum valid.

tobs 0.1.3 was successfully installed ?


Add the tobs CLI to your system binaries with:

sudo cp /home/sven/.tobs/bin/tobs /usr/local/bin

Alternatively, add tobs to your path in the current session with: export PATH=$PATH:/home/sven/.tobs/bin

After starting your Kubernetes cluster, run

tobs install

sven@x1carbon:~$ sudo cp /home/sven/.tobs/bin/tobs /usr/local/bin
sven@x1carbon:~$ tobs install
Adding Timescale Helm Repository
Error: could not install The Observability Stack: exec: "helm": executable file not found in $PATH
Ah, yes, k3s does lots of things, but it doesn’t give you the helm cli… potter off to the latest release tag of helm, after finding a GH issue on k3s about the lack of helm cli support – horrible UX: download using Firefox, then…
sven@x1carbon:~/Downloads$ tar xvf helm-v3.4.2-linux-amd64.tar.gz 
linux-amd64/
linux-amd64/helm
linux-amd64/README.md
linux-amd64/LICENSE
sven@x1carbon:~/Downloads$ cp linux-amd64/helm /usr/local/bin/
sven@x1carbon:~/Downloads$ chmod 755 /usr/local/bin/h
chmod: cannot access '/usr/local/bin/h': No such file or directory
sven@x1carbon:~/Downloads$ chmod 755 /usr/local/bin/helm
sven@x1carbon:~/Downloads$ helm
The Kubernetes package manager

------------8<------------

sven@x1carbon:~/Downloads$ tobs install
Adding Timescale Helm Repository
"timescale" has been added to your repositories
Fetching updates from repository
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "timescale" chart repository
Update Complete. ⎈Happy Helming!⎈
Installing The Observability Stack
Error: could not install The Observability Stack: exit status 1
Output: Error: Kubernetes cluster unreachable: Get "http://localhost:8080/version?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
 oh, yeah, k3s – so need
sven@x1carbon:~/Downloads$ export KUBECONFIG=/etc/rancher/k3s/k3s.yaml 

sven@x1carbon:~/Downloads$ tobs install
Adding Timescale Helm Repository
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /etc/rancher/k3s/k3s.yaml
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /etc/rancher/k3s/k3s.yaml
"timescale" already exists with the same configuration, skipping
Fetching updates from repository
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /etc/rancher/k3s/k3s.yaml
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /etc/rancher/k3s/k3s.yaml
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "timescale" chart repository
Update Complete. ⎈Happy Helming!⎈
Installing The Observability Stack
Waiting for pods to initialize...
2020/12/28 11:25:35 stat /home/sven/.kube/config: no such file or directory
looks like Tobs makes a bad assumption too –
sven@x1carbon:~/Downloads$ tobs grafana change-password 'something'
2020/12/28 11:26:43 stat /home/sven/.kube/config: no such file or directory
yup. tobs is running tho – so its ‘just’ because I’ve not created a the ~/.kube/config file 🙂
sven@x1carbon:~/Downloads$ helm list
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /etc/rancher/k3s/k3s.yaml
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /etc/rancher/k3s/k3s.yaml
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
tobs default 1 2020-12-28 11:25:24.993759053 +1000 AEST deployed tobs-0.1.3 0.1.3
creating an empty ~/.kube/config isn’t quite enough – but there’s a PR for this issue. build it, and use it – it works…
sven@x1carbon:~/Downloads$ tobs grafana change-password 'something'
Updating secret...
Changing password...
t=2020-12-28T01:45:10+0000 lvl=info msg="Connecting to DB" logger=sqlstore dbtype=postgres
t=2020-12-28T01:45:10+0000 lvl=info msg="Starting DB migrations" logger=migrator

Admin password changed successfully ✔

sven@x1carbon:~/Downloads$ tobs grafana port-forward
Listening to pod tobs-grafana-786cf49767-8f4r4 from port 8080
Forwarding from 127.0.0.1:8080 -> 3000
Forwarding from [::1]:8080 -> 3000
at which point, I stopped writing, made a “Ruuvi-tag to Prometheus metrics” program, and have been watching the temperatures of our new fridge, outside and inside. Its clearly time to redo all this using Terraform.

Author: Sven Dowideit

You might remember me from tools like http://TWiki.org, http://Foswiki.org, https://github.com/docker/Boot2Docker, Docker documentation, or https://github.com/rancher/os

Leave a Reply