Looking on k8s through a Lens…

... or better with a tool call Lens which can be found on k8slens.dev.

Ok, so here is another chapter in my k8s adventures. This time it is somewhat positive. Let’s start from the beginning. Recently I watched a video "How To Replace Docker With nerdctl And Rancher Desktop" from the DevOps Toolkit Youtube channel. In that video there was a compelling argument to switch from Docker for Mac/Windows to Rancher Desktop. Three arguments sold me the switch.

image.png

First there is a simple installation tool. Simply download the install tool from rancherdesktop.io. It is available for Windows, Mac and Linux. Look at the Rancher Sandbox Github page for details on the requirements. After the download, start the install process. Everything else is done in the background, and you have a somewhat normal dev environment. And after a while Rancher Desktop is running and most likely without hassle.

image.png

Second there are some nice cli tools installed by default. Ok first of all kubectl and then nerdctl, which in most parts is comparable to the docker and docker-compose cli commands. Except for some small exceptions, e.g. prune is not available, yet.

And at last there is k8s or better k3s from Rancher running beneath the hood. Ok it is not the full fledged k8s stack, but k3s is for the most parts all you need.

image.png

So I was very pleased about the hassle free experience and having a future proof k8s stack as a replacement for a product which will rather sooner than later is no good alternative for development with container on developer machines anymore.

Now what, I have a k8s stack running on my mac desktop, but as you might read on a previous blog post, I do not want to mess around with k8s config files so much. So I looked around for an easy way to deal with k8s configs, on google of course, and I found k8slens.dev with their tool Lens. A tool for managing k8s clusters. It is an electron based app, like VS Code. It was very easy to connect to Rancher Desktop and see all the guts of this k3s cluster. Even installing some helm charts was easy.

And of course Lens is not limited to the desktop, I could easily connect to my k3s cluster on my Raspberry Pi, too. So I’m even more pleased, that my love hate relationship for k8s might have swung to love again.

Of course with all that positive experiences, I had to try something new. Also recently I saw a video from the Techno Tim Youtube Channel, about Uptime Kuma, an open-source alternative for the commercial Uptime service.

First I wanted to try the install method, described on the Github page, but then I thought why not look for a Helm chart. And guess what I found one. But then the first drawback, I was not able to use this Github based helm chart. Ok no problem, of to the command line I went. Added the repo, did the repo update and did the helm install. Everything worked fine, but, isn’t there always a but. But the installed Uptime Kuma was only available with an external URL "chart-example.local". And of course I could add it to the hosts file, but nah, that’s lame.

So I googled around and found the "helm show" way to get the variables. And I learned how to overwrite the values. I configured an uptime.x.y in my Pi-Hole DNS, configured the helm values file to my likings. Used "helm install" and in no time Uptime Kuma was running, but of course in ClusterIP mode. Ok, rollback. Changed to "type: LoadBalancer", but I don’t know why, I only could access it through the port 3001. So I fiddled around for at lease two hours, trying and turning comments on and off until, ja, until I found a solution. Here it is, I couldn’t figure out exactly why I have to do it this way, but it worked and that was good enough for me. And I didn’t cared much, since it was working as I wanted it.

service:
  type: LoadBalancer
  ports:
    http:
      port: 80
      targetPort: 3001


ingress:
  name: traefik-ingress-uptime
  enabled: true
  namespace: default
  annotations:
    kubernetes.io/ingress.class: traefik
    traefik.frontend.passHostHeader: "false"
    traefik.frontend.priority: "1"

#     kubernetes.io/ingress.class: nginx
#     kubernetes.io/tls-acme: "true"
#     nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
#     nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
#     nginx.ingress.kubernetes.io/server-snippets: |
#       location / {
#         proxy_set_header Upgrade $http_upgrade;
#         proxy_http_version 1.1;
#         proxy_set_header X-Forwarded-Host $http_host;
#         proxy_set_header X-Forwarded-Proto $scheme;
#         proxy_set_header X-Forwarded-For $remote_addr;
#         proxy_set_header Host $host;
#         proxy_set_header Connection "upgrade";
#         proxy_set_header X-Real-IP $remote_addr;
#         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#         proxy_set_header   Upgrade $http_upgrade;
#         proxy_cache_bypass $http_upgrade;
#         }
  hosts:
  - host: uptime.x.y
    paths:
    - path: /
      backend:
        serviceName: uptime-kuma
        servicePort: 3001
#   tls:
#     - secretName: uptime-x-y-tls
#       hosts:
#         - uptime.x.y

And a special ingress config:

piVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: traefik-ingress-uptime
  namespace: default
  annotations:
    kubernetes.io/ingress.class: traefik
    traefik.frontend.passHostHeader: "false"
    traefik.frontend.priority: "1"
spec:
  rules:
  - host: uptime.x.y
    http:
      paths:
      - path: /
        backend:
          serviceName: uptime-kuma
          servicePort: 3001

Oh, one little funny side note, of course in my config ordeals I misspelled “kuma” at some point with “karma”, and of course it messes everything up, and since the two words almost looks the same, it is not easy to spot. :-)

Now you have read through my post, you would say, your ordeal has to do with my somewhat hate for how k8s is configured, but you know, of course it is nice to get your V8 of your Mustang or Charger running again and enjoy a Sunday drive out. But sometimes you simply want to hop in your F150 push the start button and ride to your destination. And exactly that’s it what I want most of the time from k8s. Install an app or service make some minor adjustments and be done with it and I can use the app and /or service.

image.png

Well, anyway. At the end I got Uptime Kuma running and I put it on my monitoring pi and other services. After installing a rotating Tab chromium extensions, I now have Weather and Uptime Kuma on rotation and enjoy my home grown monitoring. And I will extend it in the future, as soon as I get my hand on three more Raspberry PI 4B+. I will extend my k8s cluster with some agents and move all my docker based services to the new k8s cluster.

As always apply this rule: "Questions, feel free to ask. If you have ideas or find errors, mistakes, problems or other things which bother or enjoy you, use your common sense and be a self-reliant human being."

Have a good one. Alex