restore kubelet.conf via foremost or scalpel

11/12/2020

/etc/kubernetes/kubelet.conf on was deleted. may be anyone has

/etc/foremost.conf format for conf file to restore

or is it possible to regenerate this config without cluster init ort may be some was used scalpel for such restorations

-- Vladimir Knysh
kubernetes
linux
undelete

2 Answers

11/13/2020

Probably the easiest thing you can do is to recreate the node.

But if you really don't want to recreate it, Kubernetes The Hard Way provides great explaination how to generate this file by hand.

Check out:

-- Matt
Source: StackOverflow

12/3/2020

As for restoring "kubelet.conf" file option.

If you need to add custom type files' configuration to foremost, just remember that admin kubeconfig file does not differ from other kubeconfig files. Just look at existing one from one of your worker nodes.

Reconstructing "kubelet.conf" from scratch options:

  • Option A

Running following command with kubeadm* ** will help to re-create a new kubeconfig file dedicated for control plane node

kubeadm init phase kubeconfig kubelet --kubeconfig-dir=/tmp/new/

*it stores a new kubeconfig kubelet.conf file in /tmp/new/ dir instead default location /etc/kubernetes/kubelet.conf<br> ** it's kind of workaround, and gives actually newly generated client certificate for control plane node

  • Option B

Proper way of getting back control plane's credentials is through CSR API, quoting after official documentation:

After your control plane is up, you should request all kubelet credentials from the CSR API

How to achieve it is documented in admin section of K8S doc here:

-- Nepomucen
Source: StackOverflow