kubernetes: CSINode object is not recreated after Node object is recreated
What happened?
A preemptible Node got deleted and recreated with the same name, however during csi driver registration the CSINode object was updated while it still had an ownerReference to the old Node uid. Then the CSINode object got garbage collected and we’re left with no CSINode object, causing attach/mount operations to fail.
Some audit logs with a timeline of events:
Old node uuid is ef26e636-556b-4af7-ba9e-fecece154997
The replacement Node object was created after preemption:
DEFAULT 2023-07-28T07:59:59.649269Z [protoPayload.methodName: io.k8s.core.v1.nodes.create]
"metadata": {
"uid": "bec5b072-7eb8-4ab9-a5c7-e4242414e3e0"
},
There was an update to CSINode to register the driver, however the CSINode object updated has an owner reference to the old Node uid.
DEFAULT 2023-07-28T08:00:33.437252Z [protoPayload.methodName: io.k8s.storage.v1.csinodes.update]
"ownerReferences": [
{
"apiVersion": "v1",
"kind": "Node",
"uid": "ef26e636-556b-4af7-ba9e-fecece154997"
}
},
"spec": {
"drivers": ....
}
The CSINode was then garbage collected because the old Node object was deleted.
DEFAULT 2023-07-28T08:01:09.931137Z [protoPayload.methodName: io.k8s.storage.v1.csinodes.delete] [protoPayload.authenticationInfo.principalEmail: system:serviceaccount:kube-system:generic-garbage-collector]
"ownerReferences": [
{
"apiVersion": "v1",
"kind": "Node",
"uid": "ef26e636-556b-4af7-ba9e-fecece154997"
}
Then CSINode was not recreated until some time later, after the driver was manually restarted.
What did you expect to happen?
CSI driver registration should update/recreate the correct CSINode object.
How can we reproduce it (as minimally and precisely as possible)?
It’s a race condition between the garbage collector and csi driver registration.
The csi driver needs to start up and register before the old CSINode object gets garbage collected.
Anything else we need to know?
No response
Kubernetes version
$ kubectl version
1.25
Cloud provider
OS version
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here
# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, …) and versions (if applicable)
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 24 (17 by maintainers)
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
lifecycle/staleis appliedlifecycle/stalewas applied,lifecycle/rottenis appliedlifecycle/rottenwas applied, the issue is closedYou can:
/remove-lifecycle stale/closePlease send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
I don’t think it should block the Node initiatialization, however it should block csi initialization.