Change:
I tried to run a standalone kubelet (without kube-apiserver, so no kubeClient in kubelet), but there is a panic "invalid memory address or nil pointer dereference" The corresponding logs: I expect standalone kubelet to run without panic. Run a standalone kubelet I think this is a problem of passing into without checking if it is nil. Related code snippet: In , passed the nil into : In , passed the nil into : In , used the nil without checking: <detailsI'm only running kubelet, the kubelet version is Kubernetes v1.22.7-rc.0.17+-dirty </details<detailsNot using cloud provider </details<details</details<detailsI installed with source code, the tag is </details<detailscontainerd 1.4.12 </details<details</details
/sig node
/sig storage The key is to know where to put the :)
I would like to work on this
/assign
Just to make sure, is the command to run standalone kubelet just "./kubelet"?
Hi, the full command used to run the standalone kubelet is as below:
/triage accepted /priority important-soon
is passed in and func also should i add a check for nil reference on volumemanager.NewVolumeManager() only?
What should be the default value of , value which should be used when it is .
I'm not familiar with this code, the description looks correct but people familiar with the VolumeManager should be able to say what is the correct behavior when kubelet runs in standalone mode and it doesn't have a client
What should be the default value of kubeClient, value which should be used when it is nil ?
If Kubelet is running in standalone mode, there is no apiserver and should be nil. From my first look, I think the change should be something like above.
We can't just skip updating node objects and still do rest of reconstruction if is nil. This could potentially be unsafe because volumes which are being used may not be reported correctly via node APIs. So we need to rethink - what volume functions are expected to work if api-server is unavailable? Is standalone mode supposed to mount any volumes at all? cc If kubelet is not supposed to be mounting any volumes at all, then shouldn't kubelet not even start volume-manager in standalone mode? Is api-server unavailability permanent or just during startup? I am not familiar with standalone mode of kubelet and hence the question. /sig node
Could you please give your thoughts on the above comment.
hostPath volumes, certainly
api-server unavailability does not result in a nil kubeClient... a nil kubeClient means the kubelet was started in standalone mode and was told not to talk to a kube-apiserver
if kubeClient is nil, no volume that requires information from an API object is expected to be used (anything using a PVC, configmap, secret, etc)

Discussion:
func (rc *reconciler) updateStates(volumesNeedUpdate map[v1.UniqueVolumeName]*reconstructedVolume) error { // Get the node status to retrieve volume device path information. <del> rc.updateDevicePath(volumesNeedUpdate) </del> <ins> // Skip reporting devicePath in node objects if kubeClient is nil. // In standalone mode, kubelet is not expected to mount any attachable volume types or secret, configmaps etc. if rc.kubeClient != nil { rc.updateDevicePath(volumesNeedUpdate) } </ins> for _, volume := range volumesNeedUpdate { err := rc.actualStateOfWorld.MarkVolumeAsAttached(