Tasks

Step-by-step instructions for performing operations with Kubernetes.

Documentation for Kubernetes v1.8 is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date documentation, see the latest version.

Edit This Page

Set Kubelet parameters via a config file

FEATURE STATE: Kubernetes v1.8 alpha

This feature is currently in a alpha state, meaning:

  • The version names contain alpha (e.g. v1alpha1).
  • Might be buggy. Enabling the feature may expose bugs. Disabled by default.
  • Support for feature may be dropped at any time without notice.
  • The API may change in incompatible ways in a later software release without notice.
  • Recommended for use only in short-lived testing clusters, due to increased risk of bugs and lack of long-term support.

As of Kubernetes 1.8, a subset of the Kubelet’s configuration parameters may be set via an on-disk config file, as a substitute for command-line flags. In the future, most of the existing command-line flags will be deprecated in favor of providing parameters via a config file, which simplifies node deployment.

Before you begin

Create the config file

The subset of the Kubelet’s configuration that can be configured via a file is defined by the KubeletConfiguration struct here (v1alpha1). The configuration file must be a JSON or YAML representation of the parameters in this struct. Note that this structure, and thus the config file API, is still considered alpha and is not subject to stability gurarantees.

Create a file named kubelet in its own directory and make sure the directory and file are both readable by the Kubelet. You should write your intended Kubelet configuration in this kubelet file.

For a trick to generate a configuration file from a live node, see Reconfigure a Node’s Kubelet in a Live Cluster.

Start a Kubelet process configured via the config file

Start the Kubelet with the KubeletConfigFile feature gate enabled and the Kubelet’s --init-config-dir flag set to the location of the directory containing the kubelet file. The Kubelet will then load the parameters defined by KubeletConfiguration from the kubelet file, rather than from their associated command-line flags.

Relationship to Dynamic Kubelet Config

If you are using the Dynamic Kubelet Configuration feature, the configuration provided via --init-config-dir will be considered the “last known good” configuration by the automatic rollback mechanism.

Note that the layout of the files in the --init-config-dir mirrors the layout of data in the ConfigMaps used for Dynamic Kubelet Config; the file names are the same as the keys of the ConfigMap, and the file contents are JSON or YAML representations of the same structures. Today, the only pair is kubelet:KubeletConfiguration, though more may emerge in the future. See Reconfigure a Node’s Kubelet in a Live Cluster for more information.

Analytics

Create an Issue Edit this Page