Wrong directory owner when mount persistent volume
andriishestakov opened this issue · 4 comments
andriishestakov commented
When persistence storage for database and alarms enabled, netdata container fails with following errors:
2021-11-30 10:46:04: netdata FATAL : MAIN : Cannot create directory '/var/lib/netdata/registry'. # : Invalid argument
2021-11-30 10:46:49: netdata ERROR : MAIN : Failed to initialize database at /var/cache/netdata/netdata-meta.db, due to "unable to open database file"
2021-11-30 10:46:49: netdata FATAL : MAIN : Cannot initialize localhost instance with name 'netdata-parent-6766956cdd-sxddg'. # : Invalid argument
Directories /var/lib/netdata
and /var/cache/netdata
where attached volumes are owned by root.
Following workarounds works for me:
Change owner of directories:
chown 201 /var/lib/netdata /var/cache/netdata
OR set security context to run as user 201:
diff --git a/charts/netdata/templates/deployment.yaml b/charts/netdata/templates/deployment.yaml
index c81658c..91bec80 100644
--- a/charts/netdata/templates/deployment.yaml
+++ b/charts/netdata/templates/deployment.yaml
@@ -33,6 +33,8 @@ spec:
spec:
securityContext:
fsGroup: 201
+ runAsUser: 201
+ runAsGroup: 201
garrmark commented
I'm seeing the same thing, but the workaround doesn't work for me.
M4itee commented
Hey, what kind of the storage are you both using?
M4itee commented
Closing due to lack of answer