Can I store my application data in kubernetes configuration resources?

9/29/2018

I am trying to find a DB (object storage) for my application. The application is really a wrapper over ISTIO Network Routing API. Basically simplifying the ISTIO configuratin for my network. Kubernetes (k8s) Custom Resource Definition (CRD) seems to fit my requirements. Also love the watch and REST API capability provided by CRD.

DB requirement

  • Few 100 MBs data - worst case
  • Ability to watch objects
  • REST API support for object
  • Persistence
  • Around 2k writes/sec and similar/more reads/sec. Although I do have my application acting as a proxy for CRD where things can be cached.

Why using CRD will be a good or a bad idea? Are there any performance implication using CRD. This 2016 stackflow answer suggest that etcd data is not in RAM. Whereas etcd link suggest that etcd can do 10k writes/sec (so even things are not in RAM and purely in disk, who cares).

I am seeing multiple application using k8s CRDs.

  • Helm uses CRDs to store releases
  • Istio uses CRDs to store their networking routing API objects
-- Jay Rajput
kubernetes

1 Answer

9/29/2018

Considering that (CRD page)

  • A resource is an endpoint in the Kubernetes API that stores a collection of API objects of a certain kind. For example, the built-in pods resource contains a collection of Pod objects.

  • A custom resource is an extension of the Kubernetes API that is not necessarily available on every Kubernetes cluster. In other words, it represents a customization of a particular Kubernetes installation.

A CRD is for extending Kubernetes itself, it is not for application data.

The helm-crd/examples/mariadb.yaml is about lightweight metadata which will enable Kubernetes to download the right release and through Helm install it.

It is not to store data for a random application which could exist without Kubernetes (as opposed to Helm releases, which make sense only in a Kubernetes deployment scenario)

Similarly, Istio CRD makes sense only in a Kubernetes context:

Kubernetes currently implements the Istio configuration on Custom Resource Definitions (CRDs). These CRDs correspond to namespace-scope and cluster-scope CRDs and automatically inherit access protection via the Kubernetes RBAC.

That approach (using etcd to store any application data) would not scale.

-- VonC
Source: StackOverflow