'How should Kubernetes controllers interleave spec and status updates?
I have a Kubernetes cluster with a hardware node that has a CD-ROM device attached. I want to describe the device with a custom resource. (I might buy a second device, and I'd like to control both devices uniformly.) I imagine that this custom resource can describe whether the CD tray is open and whether a disc is inserted. To manage the custom resource, I'm writing a controller.
I know, broadly, that a Kubernetes controller should read the .spec
of objects and update .status
. I also know that .spec
reflects the desired state, and .status
reflects the actual state. Could I store requests to open or close the tray in .spec
? If so, do I also include the tray status in .status
, or should my controller alter .spec
?
I'm working with k3s, but I don't think that that matters.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|