Weather and k8s
I have a netatmo weather station, that has been providing data for the last year. I would like to build a little display that shows the current wind speed.
The display
I used a 7 inch touchscreen
display
for the display. I have ~/.config/lxsession/LXDE-pi/autostart
as below.
@xset s off
@xset -dpms
@xset s noblank
@xrandr --output DSI-1 --rotate inverted
@pcmanfm --desktop --profile LXDE
@/usr/bin/chromium-browser --kiosk https://home-display.tail464ff.ts.net/ --enable-features=OverlayScrollbar
There’s lots of ideas and advice out here.
The API
Auth.
The hardest part of the API was auth. I implemented the three way oauth dance to get a token, and to refresh tokens before expiry. Once I had a token, the actual calls are simple enough. There’s only 1 point an hour.
K8s
This is this first thing I have built on the k8s cluster, so there was some yak shaving to get stuff working.
private docker image registry
I ended up running private docker registry for images. I find I kept building new images all the time. I set the registry up on docker itself.
I ended up with a script to build new images, using commands like below.
docker build -t registry.tail464ff.ts.net/home-display -t home-display -f Dockerfile .
docker push registry.tail464ff.ts.net/home-display
Secrets
This has a collection of secrets - the oauth client ID and client secret, and
then the token and refresh tokens. I put these in a k8s secret, using kubectl
to get started (docs). This is working pretty well so far.
K8s Cluster config
For the secrets, I ended up copying and pasting the code below to enable access to the secrets from within or outside the cluster.
tailscale
I’m still using the tailscale ingress. I discovered it needs a TLS server on the pod to actually work.