11
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

kube-awsのカーネルパラメータチューニング

Last updated at Posted at 2017-10-16

背景

ホストOS(CoreOS)のデフォルトのカーネルパラメータがいくつか渋かったのでチューニングしたかった。
kubernetesのノードレベルでオートスケールする想定なので、スケール時にチューニングされている必要があった。
kube-awsの customFilescustomSystemdUnits で実装することでチューニング済みのノードが生成されるようになった。

現状確認

パラメータはこちらの記事を参考にした。
Dockerホストのパフォーマンスを引き出すTCPカーネルパラメータチューニング

CoreOS Stable(1520.6.0)のデフォルトのカーネルパラメータはこんな感じ。
sysctl -a とか sysctl net.core.somaxconn で確認できる。記事で言われている値がけっこう渋い。

fs.file-max = 400143
net.core.somaxconn = 128
net.ipv4.tcp_max_syn_backlog = 128
net.core.netdev_max_backlog = 1000
net.ipv4.ip_local_port_range = 32768	60999
net.ipv4.tcp_tw_reuse = 0

設定

customFiles だけでは適用されないので customSystemdUnits の設定も使う。
実際のcluster.yamlの設定はこちら。clusterをアップデートしたらパラメータの反映を確認できた。

      # User defined files that will be added to the NodePool cloud-init configuration in the "write_files:" section.
      customFiles:
        - path: "/etc/sysctl.d/nf.conf"
          permissions: 0644
          content: |
            net.core.somaxconn = 65535
            net.ipv4.tcp_max_syn_backlog = 65535
            net.core.netdev_max_backlog = 16384
            net.ipv4.ip_local_port_range = 1024 65535
            net.ipv4.tcp_tw_reuse = 1

      # User defined systemd units that will be added to the NodePool cluster cloud-init configuration in the "units:" section.
      customSystemdUnits:
        - name: update-sysctl.service
          command: start
          enable: true
          content: |
            [Unit]
            Description=Update sysctl values written by customFiles
            [Service]
            ExecStart=/usr/lib/systemd/systemd-sysctl
11
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?