Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

storing some application values in kubernetes etcd?

I have application that have some user settings and it runs on kubernetes cluster. I would like the user settings to survive application crash/pod restart.

I was thinking first about having a DB instance for keeping it outside of kubernetes. Then I thought, maybe I could just abuse etcd to store small amount of custom data. Is it a good approach to keep things simple?

Another options I see:

  1. separate db instance outside of kubernetes(overkill)
  2. some json file on PV volume in kubernetes being constantly re-read.
  3. perhaps use hashicorp vault?

What would you use? Its very small amount of data

like image 351
Wojtas.Zet Avatar asked Dec 01 '25 20:12

Wojtas.Zet


2 Answers

If you want to use etcd, a Kubernetes built-in database, it's not really suited for this purpose and shouldn't be used in practice. App shouldn't know about Kubernetes. You need to use DB or PVC to store app related objects in a disk (for example json, yaml or other files).

like image 137
laimison Avatar answered Dec 03 '25 14:12

laimison


you can use Persistent Volume and Persistent Volume claim. pvc or Persistent Volume claim will keep data incase of pod restart or pod crash. this the best way i think to store user data. you can have the suitable storage type and resource size as per your requirement. you can look into official doc. Ref

like image 37
Emon46 Avatar answered Dec 03 '25 15:12

Emon46



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!