Monday 19 April 2021

Kubernetes (k3s) and certificates

 Oh, Kubernetes, how I love thee.

I've been learning and running a small cluster at home on a mix of several Raspberry Pi and a laptop. It's been a great learning experience and although it was all for internal use, I finally decided I'd try to install some certificates.

Ouch! That took a lot longer to figure out than I wanted!

Turns out that if you read up on Kubernetes and cert-manager the recommended practice is to use the nginx-ingress-controller. But when I was trying that it didn't seem to work. 

It turns out that if I had searched for k3s, then I wouldn't have had to do that deployment and I could run it all with Traefik - which is installed by default in k3s. 

So thanks but here is the right way to run cert-manager and Traefik and deploy certificates (like from LetsEncrypt.)

Wednesday 10 March 2021

Home Assistant and Zoneminder troubleshooting

 I've been using Home Assistant for a while, but never really spending a lot of time on it. 

However, as of recently, I've started playing with it a bit more and one of the things that I wanted to do was incorporate my Zoneminder cameras onto the platform.

This is rather easy with a few lines in the configuration.yaml according to the documentation at the Home Assistant page.

zoneminder:

  - host: ZM_HOST

    username: ZM_USER

    password: ZM_PASSWORD

You can add path and path_zms variables if you want.

However, I was having some problems. I kept on getting a json decoder error. 

simplejson.errors.jsondecodeerror: expecting value: line 2 column 1 (char 1)

I initially only had the host, username and password but decided to add the paths. That didn't help. I googled for answers and nothing came up that would suit this.

I couldn't figure out what was going on for a while until I did a tcpdump on the pod and noticed I was getting redirected for certain lines and 404 in others. I then looked at the server longs and that's when I realised, I was hitting the wrong site. 

What I mean is, I run multiple applications on this one host and I was going to the host by IP. I was therefore was getting a different site than intended. At first, I disabled the site to test until it finally clicked. I'm going to the host by IP in my Home Assistant configuration. 

I switched the host value from IP to FQDN and voila! Everything started working.