Search code examples
kubernetesnextcloudopenebs

How to put Nextcloud in kubernetes in maintenance mode


I'm trying to migrate my Nextcloud instance to a kubernetes cluster. I've succesfully deployed a Nextcloud instance using openEBS-cStor storage. Before I can "kubectl cp" my old files to the cluster, I need to put Nextcloud in maintenance mode.

This is what I've tried so far:

  • Shell access to pod
  • Navigate to folder
  • Run OCC command to put next cloud in maintenance mode

These are the commands I used for the OCC way:

kubectl exec --stdin --tty -n nextcloud nextcloud-7ff9cf449d-rtlxh -- /bin/bash
su -c 'php occ maintenance:mode --on' www-data
# This account is currently not available.

Any tips on how to put Nextcloud in maintenance mode would be appreciated!


Solution

  • The su command fails because there is no shell associated with the www-data user.

    What worked for me is explicitly specifying the shell in the su command:

    su -s /bin/bash www-data -c "php occ maintenance:mode --on"