Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent volumes should be initialized #121

Open
cicdteam opened this issue Jan 29, 2019 · 0 comments
Open

Persistent volumes should be initialized #121

cicdteam opened this issue Jan 29, 2019 · 0 comments

Comments

@cicdteam
Copy link

Hi!

When hostpath (and probably PVC) used as Storage clickhouse server fail to write anything to /var/lib/clickhouse/ as server process running with user id 105.

Regarding to hostPath documentation:

the files or directories created on the underlying hosts are only writable by root. You either need to run your process as root in a privileged Container or modify the file permissions on the host to be able to write to a hostPath volume

I've solved that by adding additional init container to clickhouse template (first one, before config container):

      initContainers:
      - name: chown
        image: alpine:3.6
        securityContext:
          runAsUser: 0
          fsGroup: 0
        command:
          - '/bin/sh'
          - '-c'
          - chown -R 105:106 /var/lib/clickhouse/
        volumeMounts:
{{- if .Values.storage.hostpath }}
          - name: hostpath
            mountPath: /var/lib/clickhouse/
{{- end }}
{{- if .Values.storage.pvc }}
          - name: {{ .Values.storage.pvc.name }}
            mountPath: /var/lib/clickhouse/
{{- end }}
{{- if .Values.storage.emptyDir }}
          - name: data
            mountPath: /var/lib/clickhouse/
{{- end }}

BTW, emptyDir works well without any modifications as volume created with correct owner when runAsUser used in securityContext.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant