nextcloud
by groundhog2k
A Helm chart for Nextcloud on Kubernetes
About this chart
Nextcloud
Changelog
see RELEASENOTES.md
A Helm chart for Nextcloud on Kubernetes
TL;DR
helm repo add groundhog2k https://groundhog2k.github.io/helm-charts/
helm install my-release groundhog2k/nextcloud
Introduction
This chart uses the original Nextcloud from Docker to deploy Nextcloud in Kubernetes.
It fully supports deployment of the multi-architecture docker image.
Prerequisites
- Kubernetes 1.12+
- Helm 3.x
- PV provisioner support in the underlying infrastructure
Installing the Chart
To install the chart with the release name my-release:
helm install my-release groundhog2k/nextcloud
Upgrading the Chart
To upgrade the chart or Nextcloud version with the release name my-release:
helm upgrade my-release groundhog2k/nextcloud
Post-upgrade steps
After some Nextcloud version upgrades it's necessary to update database indicies of Nextcloud too. Therefor an post-upgrade step was prepared in this helm chart.
The post upgrade will be started during the Nextcloud/chart upgrade after a delay, which is configurable by setting postUpgradeHook.delay. The default value is 30 seconds.
helm upgrade my-release groundhog2k/nextcloud --set postUpgradeHook.delay=120
Custom *.config.php files
The chart supports adding multiple Nextcloud configuration files by setting file name and value in the customConfigs: section.
Example:
customConfigs:
region.config.php: |
<?php
$CONFIG = array (
'default_phone_region' => 'DE',
);
The custom *.config.php files will be copied during a post-install/upgrade hook that can be configured by customConfigsHook: section.
Uninstalling the Chart
To uninstall/delete the my-release deployment:
helm uninstall my-release
Requirements
| Repository | Name | Version |
|---|---|---|
| @groundhog2k | mariadb | 0.3.14 |
| @groundhog2k | postgres | 0.4.8 |
| @groundhog2k | redis | 0.7.10 |
Common parameters
| Key | Type | Default | Description |
|---|---|---|---|
| fullnameOverride | string | "" | Fully override the deployment name |
| nameOverride | string | "" | Partially override the deployment name |
Deployment parameters
| Key | Type | Default | Description |
|---|---|---|---|
| image.pullPolicy | string | "IfNotPresent" | Image pull policy |
| image.registry | string | "docker.io" | Image registry |
| image.repository | string | "nextcloud" | Image name |
| image.tag | string | "" | Image tag |
| imagePullSecrets | list | [] | Image pull secrets |
| strategy.type | object | "RollingUpdate" | Pod deployment strategy |
| livenessProbe | object | see values.yaml | Liveness probe configuration |
| startupProbe | object | see values.yaml | Startup probe configuration |
| readinessProbe | object | see values.yaml | Readiness probe configuration |
| customLivenessProbe | object | {} | Custom liveness probe (overwrites default liveness probe configuration) |
| customStartupProbe | object | {} | Custom startup probe (overwrites default startup probe configuration) |
| customReadinessProbe | object | {} | Custom readiness probe (overwrites default readiness probe configuration) |
| resources | object | {} | Resource limits and requests |
| priorityClassName | string | "" | Deployment priority class name |
| nodeSelector | object | {} | Deployment node selector |
| customLabels | object | {} | Additional labels for Deployment or StatefulSet |
| customAnnotations | object | {} | Additional annotations for Deployment or StatefulSet |
| podAnnotations | object | {} | Additional pod annotations |
| podLabels | object | {} | Additional pod labels |
| podSecurityContext | object | see values.yaml | Pod security context |
| securityContext | object | see values.yaml | Container security context |
| env | list | [] | Additional container environmment variables |
| args | list | [] | Additional container command arguments |
| serviceAccount.create | bool | false | Enable service account creation |
| serviceAccount.name | string | "" | Optional name of the service account |
| serviceAccount.annotations | object | {} | Additional service account annotations |
| affinity | object | {} | Affinity for pod assignment |
| tolerations | list | [] | Tolerations for pod assignment |
| topologySpreadConstraints | object | {} | Topology spread constraints for pods |
| containerPort | int | 8000 | Internal container port — use 8000 for Apache mode (default) or 9000 for FPM mode (nginx.enabled: true) |
| replicaCount | int | 1 | Number of replicas |
| initImage.pullPolicy | string | "IfNotPresent" | Init container image pull policy |
| initImage.registry | string | "docker.io" | Image registry |
| initImage.repository | string | "busybox" | Default init container image |
| initImage.tag | string | "stable" | Init container image tag |
| postUpgradeHook.enabled | bool | true | Enable post upgrade hook |
| postUpgradeHook.delay | int | 30 | Delay in seconds before post-upgrade steps are initiated |
| postUpgradeSteps | list | see values.yaml | Script with post upgrade steps |
| customConfigsHook.enabled | bool | true | Enable custom configuration copy hook |
| customConfigsHook.waitBeforeRetry | int | 10 | Delay before retrying to copy *.config.php files |
| customConfigsHook.retries | int | 10 | Max. number of retries before job fails |
| revisionHistoryLimit | int | nil | Maximum number of revisions maintained in revision history |
| podDisruptionBudget | object | {} | Pod disruption budget |
| podDisruptionBudget.minAvailable | int | nil | Minimum number of pods that must be available after eviction |
| podDisruptionBudget.maxUnavailable | int | nil | Maximum number of pods that can be unavailable after eviction |
Nginx sidecar parameters
When nginx.enabled is set to true, the chart switches from the Apache-based image to the PHP-FPM image (nextcloud:*-fpm) and adds an nginx container as a sidecar. The nginx sidecar acts as the HTTP reverse proxy and passes PHP requests to the FPM process via TCP (127.0.0.1:<containerPort>).
Set image.tag explicitly to an FPM image tag (e.g. 34.0.1-fpm) and containerPort to 9000 when enabling this mode.
| Key | Type | Default | Description |
|---|---|---|---|
| nginx.enabled | bool | false | Enable nginx sidecar (switches to FPM+nginx mode) |
| nginx.image.pullPolicy | string | "IfNotPresent" | Nginx image pull policy |
| nginx.image.registry | string | "docker.io" | Nginx image registry |
| nginx.image.repository | string | "nginx" | Nginx image name |
| nginx.image.tag | string | "stable" | Nginx image tag |
| nginx.containerPort | int | 8080 | HTTP port the nginx sidecar listens on |
| nginx.resources | object | {} | Resource limits and requests for the nginx sidecar |
| nginx.securityContext | object | see values.yaml | Security context for the nginx sidecar container |
| nginx.livenessProbe | object | see values.yaml | Liveness probe configuration for the nginx sidecar |
| nginx.startupProbe | object | see values.yaml | Startup probe configuration for the nginx sidecar |
| nginx.readinessProbe | object | see values.yaml | Readiness probe configuration for the nginx sidecar |
| nginx.customLivenessProbe | object | {} | Custom liveness probe (overwrites default liveness probe for nginx sidecar) |
| nginx.customStartupProbe | object | {} | Custom startup probe (overwrites default startup probe for nginx sidecar) |
| nginx.customReadinessProbe | object | {} | Custom readiness probe (overwrites default readiness probe for nginx sidecar) |
Cron jobs
| Key | Type | Default | Description |
|---|---|---|---|
| defaultCronJobs | list | '[1]' | Internal planned default cron job |
| defaultCronJobs[1].name | string | "cronphp" | Name of the default cron job |
| defaultCronJobs[1].schedule | string | "*/5 * * * *" | Schedule for the default cron job (5 minutes) |
| defaultCronJobs[1].command | string | "php -f /var/www/html/cron.php" | Command for default cron.php job |
| cronJobs | list | [] | List of additional planned cron jobs |
| cronJobs[].name | string | nil | Name of the cron job |
| cronJobs[].schedule | string | nil | Schedule for the cron job |
| cronJobs[].command | string | nil | Command for planned execution |
| cronJobs[].affinity | object | {} | Affinity for pod assignment |
| cronJobs[].tolerations | list | [] | Tolerations for pod assignment |
| cronJobs[].nodeSelector | object | {} | Deployment node selector |
| cronJobs[].resources | object | {} | Resource limits and requests |
| cronJobs[].annotations | object | {} | Additional cron job annotations |
| cronJobs[].labels | object | {} | Additional cron job labels |
Service paramters
| Key | Type | Default | Description |
|---|---|---|---|
| service.port | int | 80 | Commento HTTP service port |
| service.type | string | "ClusterIP" | Service type |
| service.nodePort | int | nil | The node port (only relevant for type LoadBalancer or NodePort) |
| service.clusterIP | string | nil | The cluster ip address (only relevant for type LoadBalancer or NodePort) |
| service.loadBalancerIP | string | nil | The load balancer ip address (only relevant for type LoadBalancer) |
| service.loadBalancerSourceRanges | list | [] | The list of IP CIDR ranges that are allowed to access the load balancer (only relevent for type LoadBalancer) |
| service.annotations | object | {} | Additional service annotations |
| service.labels | object | {} | Additional service labels |
Ingress parameters
| Key | Type | Default | Description |
|---|---|---|---|
| ingress.enabled | bool | false | Enable ingress for Nextcloud service |
| ingress.className | string | nil | Optional ingress class name |
| ingress.annotations | object | {} | Additional annotations for ingress |
| ingress.hosts[0].host | string | "" | Hostname for the ingress endpoint |
| ingress.labels | object | {} | Additional ingress labels |
| ingress.maxBodySize | string | "512m" | Maximum body size for post requests |
HTTPRoute parameters
| Key | Type | Default | Description |
|---|---|---|---|
| httpRoute.enabled | bool | false | Enable HTTPRoute for the Nextcloud service |
| httpRoute.annotations | object | {} | Additional HTTPRoute annotations |
| httpRoute.labels | object | {} | Additional HTTPRoute labels |
| httpRoute.parentRefs | list | [] | Gateway parent references (required when httpRoute is enabled and listenerSet is disabled) |
| httpRoute.hostnames | list | [] | Hostnames for the HTTPRoute |
| httpRoute.rules | list | see values.yaml | HTTPRoute rules for the Nextcloud service |
ListenerSet parameters
| Key | Type | Default | Description |
|---|---|---|---|
| listenerSet.enabled | bool | false | Enable ListenerSet for Gateway API |
| listenerSet.annotations | object | {} | Additional ListenerSet annotations |
| listenerSet.labels | object | {} | Additional ListenerSet labels |
| listenerSet.parentRef | object | {} | Gateway parent reference (required) |
| listenerSet.listeners | list | [] | Listeners to attach to the parent Gateway |
Network policies
Allows to define optional network policies for ingress and egress The policyTypes will be automatically set
| Key | Type | Default | Description |
|---|---|---|---|
| networkPolicy.ingress | object | {} | Ingress network policies |
| networkPolicy.egress | object | {} | Egress network policies |
Redis session cache
| Key | Type | Default | Description |
|---|---|---|---|
| externalCache.enabled | bool | false | Enable external Redis cache |
| externalCache.host | string | nil | External Redis host |
| externalCache.password | string | nil | External Redis password |
| externalCache.port | int | 6379 | External Redis port |
| redis.enabled | bool | false | Enable Redis cache deployment (will disable external cache settings) |
| redis.storage | string | nil | Redis storage settings |
Database settings
| Key | Type | Default | Description |
|---|---|---|---|
| externalDatabase.host | string | nil | External database host |
| externalDatabase.name | string | "nextcloud" | External database name |
| externalDatabase.user | string | nil | External database user name |
| externalDatabase.password | string | nil | External database user password |
| externalDatabase.type | string | "sqlite" | External database type (mariadb/mysql or postgres - default: sqlite) |
| mariadb.enabled | bool | false | Enable MariaDB deployment (will disable external database settings) |
| mariadb.settings.arguments[0] | string | "--character-set-server=utf8mb4" | Enable MariaDB UTF8MB4 character set |
| mariadb.settings.arguments[1] | string | "--collation-server=utf8mb4_unicode_ci" | Enable UTF8MB4 unicode |
| mariadb.settings.rootPassword | string | nil | MariaDB root user password |
| mariadb.storage | string | nil | MariaDB storage settings |
| mariadb.userDatabase.name | string | nil | MariaDB nextcloud database name |
| mariadb.userDatabase.password | string | nil | MariaDB nextcloud database user |
| mariadb.userDatabase.user | string | nil | MariaDB nextcloud database |
Deploy nextcloud with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has nextcloud on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartnextcloud is pinned at v0.22.10 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply