Tune Kubernetes Worker Nodes for Production

To get the best performance from your hardware, set Redpanda to production mode on each worker node and run the autotuner tool. The autotuner identifies the hardware configuration on your worker node and optimizes the Linux kernel to give you the best performance.

Prerequisites

Make sure that your current Linux user has root privileges. The autotuner requires privileged access to the Linux kernel settings.

Install Redpanda

To run the autotuner, you need to install the Redpanda binary on each worker node.

  • Fedora/RedHat

  • Debian/Ubuntu

# Run the setup script to download and install the repo
curl -1sLf 'https://dl.redpanda.com/nzc4ZYQK3WRGd9sy/redpanda/cfg/setup/bash.rpm.sh' | sudo -E bash && \
# Use yum to install redpanda
sudo yum install redpanda -y
# Run the setup script to download and install the repo
curl -1sLf 'https://dl.redpanda.com/nzc4ZYQK3WRGd9sy/redpanda/cfg/setup/bash.deb.sh' | sudo -E bash && \
# Use apt to install redpanda
sudo apt install redpanda -y

Run the autotuner

Run the autotuner on each worker node that runs a Redpanda broker.

  1. Set Redpanda to production mode:

    sudo rpk redpanda mode production
  2. Run the autotuner:

    sudo rpk redpanda tune all
    Expected output:
    TUNER                  APPLIED  ENABLED  SUPPORTED  ERROR
    aio_events             true     true     true
    ballast_file           true     true     true
    clocksource            true     true     true
    coredump               false    false    true
    cpu                    true     true     true
    disk_irq               true     true     true
    disk_nomerges          true     true     true
    disk_scheduler         true     true     true
    disk_write_cache       false    true     false      Disk write cache tuner is only supported in GCP
    fstrim                 false    false    true
    net                    true     true     true
    swappiness             true     true     true
    transparent_hugepages  false    false    true

Changes to the Linux kernel are not persisted. If a worker node restarts, make sure to run sudo rpk redpanda tune all on it again.

You can use a privileged DaemonSet to schedule the autotuner on each worker node that runs a Redpanda broker. Apply taints to Nodes that successfully complete the autotuner command. Use tolerations on your Pods so that they are scheduled only on tuned worker nodes.

For details about the autotuner, including how to enable or disable an individual tuner, see the rpk redpanda tune command reference.