Install custom drivers in Node-RED

Node-RED is running on Alpine Linux as non-root by default, which makes commands like sudo apt-get impossible. This tutorial explains how to install custom software anyway.

To install new software in a Alpine Linux container running on Kubernetes with proper security measures on (like Node-RED does by default), follow these steps:

Instructions

  1. Open the StatefulSet in UMHLens and press edit

  2. Search for the following lines (using crtl + F and then searching for securityContext and change runAsUser , runAsNonRoot and fsGroup it like this:

    Untitled

  3. Now you can go into the container and add custom software / drivers using apk add PACKAGE_NAME (replace PACKAGE_NAME with the Alpine Linux package name. If you want to install, for example, unixodbc for use odbc drivers, execute apk add unixdbc. You can find the package name here (not all packages from Ubuntu are available!): https://pkgs.alpinelinux.org/packages

  4. (important!) after installation, revert these changes. set runAsNonRoot to true and the other values to 1000

Last modified February 17, 2023: update (#208) (ea731fc)