<p>kubernetes 1.7.x</p>

<p>kubelet store some data in /var/lib/kubelet, how can I change it to somewhere else ?</p>

<p>Because my /var is every small.</p>

<p>if your <code>/etc/systemd/system/kubelet.service.d/10-kubeadm.conf</code> is loading environment from <code>/etc/sysconfig/kubelet</code>, as does mine, you can update it to include your extra args.</p>

<pre><code># /etc/sysconfig/kubelet
KUBELET_EXTRA_ARGS=--root-dir=/data/k8s/kubelet
</code></pre>

<p>Entire <code>10-kubeadm.conf</code>, for reference:</p>

<pre><code># /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
# Note: This dropin only works with kubeadm and kubelet v1.11+
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use
# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.
EnvironmentFile=-/etc/sysconfig/kubelet
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
</code></pre>
