Installation of OH4 on Kuberbetes K8s

Hi,
Ive seen a few people mention that they now run OH on Kubernetes and was wondering if anyone has any instructions around accomplishing this.
I know it involves using the Docker image, but im pretty new to kubernetes, so not sure how to deploy this in my cluster.

Thanks,
Richie

For all intents and purposes you’d run OH in Kubernetes the same as you would run any Docker container in Kubernetes. Consequently this is more of a Kubernetes question and not an OH question so you are more likely to find the answers to your questions in the Kubernetes docs and their support forum and such.

k8s is a big subject
what k8s distribution? (my fav is Microk8s)
what is your ingress?
are you going to store your OH data in in the cluster using k8s support?
what services are you running that OH consumes?

  • mqtt?
  • database?
  • something else?

are you running a multi-node cluster?

  • you want a HA cluster?

what’s your authorization and authentication stratagy?
do you know how to write a k8s manifest?
do you know how to write a Helm Chart?

Hi,
Yeah, very big.
I’ve just got a standard bare metal k8s cluster (1 master & 3 workers).
Running:
rook-ceph for persistent storage
Flannel for the CNI
MetalLB for the load balancer
ingress-nginx for Ingress with cert-manager handling SSL
Kasten.io for backing up Kubernetes pods & infrastructure
Prometheus-Alertmanager-Grafana for monitoring
Pi-Hole for external DNS & DHCP.
Working on Wordpress deployment
Working on Wireguard deployment

Currently running OH4.2 on a couple of Raspberry Pis.
Will be setting up new, separate MQTT, InfluxDB and NodeRed in my k8s cluster shortly.
Need to get details on installing OpenHab & HabApp on Kubernetes.
I’m investigating using a Raspberry Pi as a USB over IP hub with usbip, which I’ve briefly tested, but not from a pod, yet.
This is just for home, so having multiple worker nodes is enough HA for the time being.
Authorisation & authentication is just basic auth on the ingress-nginx (at the moment - I’m sure I’ll change that in the future).
I’ve not yet written any manifests or Helm charts, but will be learning so I can build my own deployments (any good tutorials for this?).

Thanks,
Richie

Everything in k8s is configured in Manifests. They are YAML files that you can apply, update or remove stuff in your cluster

Helm Charts are a collection of YAML files that give you a declarative was to have your k8s configuration in a single structure and also have changes applied or rolled back atomically. There are also existing charts you can declare as dependencies in your chart so you can build your chart based on community best practices.

I would just start with helm charts
I got started with https://helm.sh/docs/intro/quickstart/

I have not yet tried to run OH in docker so how to setup an OH helm chart is in my future

Hi,
Ok, I’ve managed to install the latest OH 4.2.1 docker image on my Kubernetes cluster - so much easier than expected.
However, i need to build a docker image with USBIP built in, but have no idea how to achieve this.
Would prefer it to be on debian 12 or 11, so does anyone know how/if i can actually achieve this?

Thanks,
Richie

The easiest things to do will be to create a Docker file that’s case on the OH image. Then all you’ll need to do is run apt to install what’s missing and you are good to go.

Alternatively, you can mount a script into /etc/cont-init.d that installs what’s missing. The disadvantage of this approach is that this script will run every time the container starts whereas if you create a newmodified image everything you need will be a part of the container from the start.

1 Like

Yeah, although not something I have knowledge of doing yet. Any pointers on this?

Thanks,
Richie

There are tons of tutorials on the web. I’d start with the Docker documentation which is pretty good.

1 Like