Best practice for using projects within a container

Hello everyone,

i was trying to run node red projects (connecting to azure devops) within a container (in kubernetes / k3s). I wasn't able to connect to the repository via GUI, so in the container I executed the command

ssh-keyscan -t rsa >> /usr/src/node-red/.ssh/known_hosts

which I found here. I don't know why, but generating an ssh key within node red and using it didn't work. I had to generate a key in the commandline and use this key in node red to connect. One interesting point is that after this, the key that was generated by node red started working.

Because I need to restart the container now and then, or deploy it at different machines, I need to have persistent ssh keys that are only newly created if the container is deployed at a new machine. My approach was to create a persistent volume claim that persists the .ssh-folder. Then I wrote a shell script that executes every time the container starts, checks if there is an ssh-key and a knownhosts file and generates new files, if needed. So if I deploy the container at a new node there is a ssh-key generated that can be used to connect to repositories within node red.

As you can see, there was some workaround to get the git integration working. I guess there is a more elegant / best practice solution that I didn't find?

Thank you for any suggestions

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.