You can tweak kernel parameters at runtime (inside a pod)

But there's a good news and a bad news. The good news is, the default settings are just fine. And mindful minimal changes will surely improve system performance. For the good.

And the bad news is, if you get things wrong, it can crash your system. Leading to production issues.

And talking about production issues, here's a short attempt to explain how to manage Kubernetes production issue.

Now, coming back to this post, please watch out while making changes to kernel parameters. Test and test well before rolling to prod.

So how do you make changes? Here's how.

sysctl - a command line tool helps you to make temporary changes.

Edit and update /etc/sysctl.conf for permanent changes.

What settings can be changed with sysctl?

  • Network settings
  • Security settings
  • Filesystem settings
  • Process scheduling
  • Performance tuning
  • Memory management

Btw, you can also enable Sysctls for a Pod. And these are setup in the securityContext of your pod spec. Following is an example spec.

Warning: Wrong sysctl parameters can make your OS unstable. So make changes carefully.
apiVersion: v1
kind: Pod
metadata:
  name: sysctl-example
spec:
  securityContext:
    sysctls:
    - name: kernel.shm_rmid_forced
      value: "0"
    - name: net.core.somaxconn
      value: "1024"
    - name: kernel.msgmax
      value: "65536"
  ...        

You can read more about this here.

One more time. Sysctl changes can impact system performance.

So be cautious and be 100% certain about what you are doing.

Because certainty is not just about being right, it's also about being confident. In life & at work ??

Hope it's useful. A repost helps big time. Checkout my previous newsletter here.

Abdullateef Lawal

Advocating for Excellence in Platform Engineering, DevOps, SRE, and Cloud (Native) Technologies.

2 个月

要查看或添加评论,请登录

社区洞察

其他会员也浏览了