sysctl
"sysctl - configure kernel parameters at runtime" - man sysctl
/etc/sysctl.conf
is for storing permanent changes, sysctl
is used for making changes to the running system.
Containers caveat
Because sysctl is a kernel level feature, its values are shared between all containers running on a given node. This means that if you have containers in kubernetes that modify sysctl, this alters the behavior of every other container in every pod running on that same node. It also means that if you do such things, you cannot rely on those values being consistent because they are not managed in a central place, but instead are being modified by pods that are scheduled on the node. Because of this, it's a good idea to try to avoid this if at all possible, and if you need to tweak sysctl for pods, try to account for that in your pod affinities.
sysctl command examples
Show all kernel variables for the in-memory kernel
sysctl -a
Assign a new variable for the running kernel to use
sysctl -w variable=value
Load values from /etc/sysctl.conf
sysctl -p
sysctl.conf examples
Reboot after 10 seconds if kernel panics
kernel.panic = 10
Treat all oopses as panics
kernel.panic_on_oops = 1