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

Follow
Table of Contents

Task

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 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.

Pre-requisites

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 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"
  3. 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"
  3. After configuring other cluster options as desired, provision the cluster by invoking rke up --config <cluster configuration YAML file>.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.