cilium icon indicating copy to clipboard operation
cilium copied to clipboard

Make node-init depend on /bin/sh instead of /bin/bash

Open skurfuerst opened this issue 5 years ago • 8 comments

Bug report

When using K3S / K3D on Docker for Mac, Node-Init will fail because of cilium's reliance on /bin/bash. The rancher/k3s image (where this is executed) only has a /bin/sh shell, as it is based on Busybox.

Thus I'd recommend to change the node-init script to be /bin/sh compatible :-)

General Information

  • Cilium version (run cilium version): 1.9.1
  • Kernel version (run uname -a) ?
  • Orchestration system version in use (e.g. kubectl version, Mesos, ...): Docker for Desktop on K3S/K3D

How to reproduce the issue

See https://sandstorm.de/de/blog/post/running-cilium-in-k3s-and-k3d-lightweight-kubernetes-on-mac-os-for-development.html and https://github.com/cilium/cilium/issues/10516#issuecomment-748519884

All the best, Sebastian

skurfuerst avatar Dec 23 '20 20:12 skurfuerst

I'll try to get it sorted out!!

stafordtituss avatar Dec 28 '20 10:12 stafordtituss

Awesome @stafordtituss - thank you so much ❤️

skurfuerst avatar Dec 28 '20 17:12 skurfuerst

@stafordtituss Did you find time to work on this? Do you need any help or pointers?

pchaigno avatar Feb 03 '21 16:02 pchaigno

@skurfuerst Is it only the init script that needs to be changed? Do you know of other scripts that also need to not be bash-based?

Do you have a link to the script in github?

dmusicant-dk avatar May 05 '21 00:05 dmusicant-dk

If I understand correct, this template file needs to be updated accordingly: https://github.com/cilium/cilium/blob/master/install/kubernetes/cilium/templates/cilium-nodeinit-daemonset.yaml

miynat avatar May 11 '21 22:05 miynat

If I understand correct, this template file needs to be updated accordingly: https://github.com/cilium/cilium/blob/master/install/kubernetes/cilium/templates/cilium-nodeinit-daemonset.yaml

I'm not sure that's correct. The issue is the ".sh" script that is run in the container which cilium deploys is a bash script, but the docker containers used by k3d doesn't have bash. The YAML used to do the install should otherwise be fine. (I believe, please let me know if I'm understanding that incorrectly)

dmusicant-dk avatar May 12 '21 00:05 dmusicant-dk

AFAICS, this template file is used to build up the cilium node-init docker image, and the relevant shell script is in the STARTUP_SCRIPT section of that template file here -> https://github.com/cilium/cilium/blob/master/install/kubernetes/cilium/templates/cilium-nodeinit-daemonset.yaml#L134. That script should be updated to get rid off bashisms in it. (Please note that I'm not an expert on this, these are just my observations.)

miynat avatar May 12 '21 20:05 miynat

I found we already called /bin/sh in node init daemonset in https://github.com/cilium/cilium/blob/master/install/kubernetes/cilium/templates/cilium-nodeinit/daemonset.yaml#L57. Does this issue still available? @pchaigno @aanm

MikeLing avatar Aug 09 '22 03:08 MikeLing