How to best model external resources as Pod dependencies

6/27/2019

I have a set of ephemeral networked devices that exist today. These broadcast their availability and I have a service that knows all currently available resources. Both the devices and this service exist outside of any Kubernetes cluster currently.

I’d like for there to be a 1:1 mapping between these ephemeral devices and a Pod. As the devices come and go the number of Pod replicas should scale.

Apologies if I have this all wrong but based on my reading of how to extend Kubernetes it feels that:

  1. I should model my devices with a Custom Resource Definition, e.g. EphemeralNetworkedDevice
  2. My service tracking the available devices should be a Custom Resource Controller, e.g. EphemeralNetworkedDeviceController, which keeps the Kubernetes scheduler updated as to what EphemeralNetworkedDevices exist

What I absolutely cannot understand is how I can define the dependent relationship between my Pod and an EphemeralNetworkedDevice. If these devices were Node-local I feel they could be modelled as Device Plugins, however I do not want to restrict my compute to a single Node.

Have I entirely misunderstood the extension model? How can I go about creating this 1:1 relationship?

-- lewiz
kubernetes

0 Answers