This solution is based the code snippet provided @nsteinmetz in this issue.
If you deployed mattermost via the helm chart, you might experience the same problem as we at @schnaq did: the mounted volumes belong to root but not to the mattermost user. This is a problem if you want to install settings, or new plugins (e.g. the playbook or the focalboard).
To fix this, we checked the id
of the mattermost user in our running pod:
kubectl exec -n mattermost -it mattermost-mattermost-team-edition-aaaaaaaaa-bbbbb id
=> uid=2000(mattermost) gid=2000(mattermost) groups=2000(mattermost)
So the current user-id of the mattermost
-user is 2000
.
You can then configure your helm chart to create pods which configure the
correct permissions for the mattermost pod. Open the values.yaml from the
mattermost helm chart and find the line extraInitContainers: []
and replace it
with this snippet:
extraInitContainers:
- name: volume-mount-hack-data
image: busybox
command: ["sh", "-c", "chown -R 2000:2000 /mattermost/data"]
volumeMounts:
- name: mattermost-data
mountPath: /mattermost/data
- name: volume-mount-hack-config
image: busybox
command: ["sh", "-c", "chown -R 2000:2000 /mattermost/config"]
volumeMounts:
- name: mattermost-config
mountPath: /mattermost/config
- name: volume-mount-hack-plugins
image: busybox
command: ["sh", "-c", "chown -R 2000:2000 /mattermost/client/plugins"]
volumeMounts:
- name: mattermost-plugins
mountPath: /mattermost/client/plugins
Thanks for the guys in the related issues, it helped a lot ☀️
Related issues: