Skip to content

How to change the kubelet root directory when provisioning a Kubernetes cluster with the Rancher Kubernetes Engine (RKE) CLI or Rancher v2.x

This document (000020058) is provided subject to the disclaimer at the end of this document.

Environment

The Rancher Kubernetes Engine (RKE) CLI or a SUSE R ancher v2.x instance.

Situation

This article details how to change the path of the kubelet root directory, which defaults to /var/lib/kubelet, when provisioning a Kubernetes cluster via the Rancher Kubernetes Engine (RKE) CLI or SUSE Rancher v2.x.

N.B. Updating the kubelet root directory is only supported on new cluster provisioning, and changing this path after initial cluster provisioning is not supported.

Resolution

If you wish to use a separate filesystem for the kubelet root directory, you will need to ensure that this is mounted at the desired path on nodes prior to provisioning.

Provisioning via SUSE Rancher v2.x

  1. Click Edit as YAML when configuring the cluster in the Add Cluster view.
  2. Under kubelet in the services block, add the desired kubelet root directory path to the root-dir argument of the extra_args block, and in extra_binds, per the following example:
services:
     kubelet:
       extra_args:
         root-dir: "/my/new/folder"
       extra_binds:
    - "/my/new/folder:/my/new/folder:shared,z"
  1. After configuring other cluster options as desired, click Create or Next, respectively for Node Driver or Custom clusters, to save the new cluster configuration.

Provisioning via the RKE CLI

  1. Open the cluster configuration YAML file for the new cluster.
  2. Under kubelet in the services block, add the desired kubelet root directory path to the root-dir argument of the extra_args block, and in extra_binds, per the following example:

services: kubelet: extra_args: root-dir: "/my/new/folder" extra_binds: - "/my/new/folder:/my/new/folder:shared,z"

  1. After configuring other cluster options as desired, provision the cluster by invoking rke up --config <cluster configuration YAML file>.

Status

Top Issue

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.