top | item 41406505

(no title)

zactato | 1 year ago

I should know this, but does K8s actually store objects as a graph internally?

Is this doing multiple api calls? How does it perform at scale?

discuss

order

fatliverfreddy|1 year ago

K8s does not store any graph model internally. The relationship engine in Cyphernetes is comparing fields that should either match/contain all/etc. between two resources - for example a ResplicaSet's .metadata.ownerReferences[].name matches a Deployment's .metadata.name, or a Deployment's .metadata.labels contains all of a Service's spec.selector.

These rules are used both to read the resources but also for creating them. Each rule may also contain a set of default properties which are used in create operations - for instance:

`MATCH (d:Deployment {name: "nginx"}) CREATE (d)->(s:Service)`

Will create a clusterIp Service (similar to what `kubectl expose` does).

Doing this with kubectl or programmatically without tuning for rate limiting, implementing caching etc. of course fails even at a very small scale - Cyphernetes has its own request throttling and caching layer to make this possible.