/etc/sysctl.conf from the cloud-config works fine (and is a good central place to put it), but that’s not really the problem; the contents of this file are already persistent.
The problem is that, unlike other Linux systems, they are not applied on boot. Applying them yourself with
sysctl -p from
start.sh is a great workaround (thanks @sjiveson), however, in my opinion this is something RancherOS should do automatically.
Even more, the suggested solution does not really work for me, because the sysctls are applied a bit late in the boot process. On other Linux systems where
sysctl.conf is applied automatically, this is done in a very early stage, before any other init scripts are run. On RancherOS, it runs before “user docker”, which is great, but pretty much after everything else. A sysctl that disables IPv6 auto configuration, for example, will be applied after auto configuration is already done, making it useless here.
I guess there’s currently no way to do this; I’ll make sure to submit an issue to GitHub repo.