matomo
by POCKOST
This Helm Chart deploys a highly secured Matomo instance, optimized for demanding production environments.
About this chart
Matomo by POCKOST
An another devops company. This Helm Chart deploys a highly secured Matomo instance, optimized for demanding production environments.
| Name | Url | |
|---|---|---|
| POCKOST | [email protected] | https://pockost.com |
Security Philosophy
Unlike standard deployments, this Chart enforces strict security constraints out of the box:
- Non-Root by Default: The container runs with UID
10001. - Read-Only Root Filesystem: Increased protection against container escape and unauthorized modifications.
- Zero-Trust Networking: Restricted Ingress and Egress traffic via
NetworkPolicies. - Resource Isolation: Guaranteed CPU/RAM quotas to prevent noisy neighbor issues.
Deployment Architecture
This chart leverages a customized pockost/matomo image built directly on top of the official Matomo distribution. Out of the box, the installation comes pre-packaged with the following integrated features:
- QueuedTracking plugin: Fully configured to stream tracking data through Redis.
- RebelOIDC Plugin : Pre-configured to enable seamless OAuth2/OIDC authentication with your identity provider (such as Keycloak).
Persistence/Upgrade:
To ensure that Matomo version upgrades occur automatically via the Docker image, the persistent volume must never overlay the entire /var/www/html directory. The core application code is provided natively by the Docker image. Only instance-specific data should be persisted using separate volume mounts.
Only mount the necessary directories using subPath:
- /var/www/html/config: To preserve your database credentials and settings.
- /var/www/html/misc/user: To preserve your custom logos and assets.
Quick Start
Installation Command
helm repo add matomo oci://harbor.pockost.dev/helm-charts
helm install matomo matomo -f values.yaml
Minimal Configuration
By default, the chart automatically installs a MariaDB sub-chart in the same namespace. If you want to adapt some parameters on mariadb, you can check the helm template : https://artifacthub.io/packages/helm/cloudpirates-mariadb/mariadb
# Target Database Configuration
mariadb:
auth:
rootPassword: "root_matomo"
username: "matomo"
password: "matomo_password"
# Ingress Configuration
ingress:
enabled: true
hosts:
- host: matomo.your-domain.com
paths:
- path: /
pathType: ImplementationSpecific
### HTTPRoute (Gateway API)
httpRoute:
enabled: true
hostname: matomo.your-domain.com
parentRefs:
name: gateway
namespace: gateway
sectionName: http-wildcard
Advanced
Configuration with an External Database
mariadb:
enabled: false # Disable sub-charts
externalDatabase:
host: "mariadb.database.svc.cluster.local"
username: "matomo"
password: "matomo_password"
name: "matomo"
Already have secret
mariadb:
...
existingSecret: "mariadb-secret"
externalDatabase:
...
existingSecret: "mysql-secret"
GeoIP
Mounts the entire /misc directory, allowing Matomo to auto-update its GeoIP databases without Kubernetes file-lock permission errors.
geoip:
enabled: true
Chart Parameters
Values
| Key | Type | Default | Description |
|---|---|---|---|
| affinity | object | {} | Affinity rules for pod assignment |
| autoscaling.enabled | bool | false | Enable Horizontal Pod Autoscaler |
| autoscaling.maxReplicas | int | 100 | |
| autoscaling.minReplicas | int | 1 | |
| autoscaling.targetCPUUtilizationPercentage | int | 80 | |
| cronJobs.archive.args[0] | string | "php" | |
| cronJobs.archive.args[1] | string | "/var/www/html/console" | |
| cronJobs.archive.args[2] | string | "core:archive" | |
| cronJobs.archive.enabled | bool | true | |
| cronJobs.archive.schedule | string | "5 * * * *" | |
| cronJobs.process-queued.args[0] | string | "php" | |
| cronJobs.process-queued.args[1] | string | "/var/www/html/console" | |
| cronJobs.process-queued.args[2] | string | "queuedtracking:process" | |
| cronJobs.process-queued.enabled | bool | true | |
| cronJobs.process-queued.schedule | string | "*/1 * * * *" | |
| externalDatabase | object | {"adapter":"mariadb","existingSecret":"","host":"mariadb.database.svc.cluster.local","name":"matomo","network":{"ipBlock":"","namespace":"mariadb","podLabels":{"app.kubernetes.io/name":"mariadb"}},"password":"change_me","tablePrefix":"matomo_","username":"matomo"} | External database configuration (used only if mariadb.enabled is false) |
| externalDatabase.host | string | "mariadb.database.svc.cluster.local" | Hostname or IP address |
| externalDatabase.name | string | "matomo" | Name of the external database |
| externalDatabase.network.ipBlock | string | "" | CIDR block (IP range) if the database is located outside the cluster |
| externalDatabase.network.namespace | string | "mariadb" | Namespace where the database resides if it is inside the cluster |
| externalDatabase.network.podLabels | object | {"app.kubernetes.io/name":"mariadb"} | Pod labels used to target the database pods for Egress rules |
| externalDatabase.password | string | "change_me" | Password for the external database connection (ignored if existingSecret is set) |
| externalDatabase.tablePrefix | string | "matomo_" | Prefix for Matomo database tables to avoid conflicts |
| extraEnvs | object | {"PHP_MEMORY_LIMIT":"512M"} | Extra environment variables to pass directly to the Matomo container |
| extraVolumeMounts | list | [] | Extra volume mounts for the container |
| extraVolumes | list | [] | Extra volumes for the pod |
| fullnameOverride | string | "" | String to fully override fullname template |
| geoip | object | {"enabled":false} | Add volumeMounts on misc/ to have compatibility with geoIP |
| httpRoute.annotations | object | {} | HTTPRoute annotations. |
| httpRoute.enabled | bool | false | HTTPRoute enabled. |
| httpRoute.hostname | string | "chart-example.local" | Target hostname for the application |
| httpRoute.parentRefs | object | {"name":"gateway","namespace":"gateway","sectionName":"http-wildcard"} | Gateway target configuration |
| httpRoute.parentRefs.name | string | "gateway" | Name of the target Gateway global resource |
| httpRoute.parentRefs.namespace | string | "gateway" | Namespace where the target Gateway is deployed |
| httpRoute.parentRefs.sectionName | string | "http-wildcard" | Specific listener section name to attach |
| image.pullPolicy | string | "Always" | Image pull policy |
| image.repository | string | "docker.io/pockost/matomo" | Image repository for phpMyAdmin |
| image.tag | string | "" | Image tag (overrides the chart's appVersion) |
| imagePullSecrets | list | [] | Secrets for pulling images from private registries |
| ingress.annotations | object | {} | Ingress annotations |
| ingress.className | string | "" | Ingress Class Name |
| ingress.enabled | bool | false | Enable Ingress controller resource |
| ingress.hosts | list | [{"host":"chart-example.local","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}] | Ingress host configurations |
| ingress.tls | list | [] | Ingress TLS configuration |
| listenerSet.annotations | object | {} | Additional annotations for the ListenerSet resource |
| listenerSet.enabled | bool | false | Enable Gateway API ListenerSet resource and link it to the HTTPRoute |
| listenerSet.listeners | list | [] | Custom listeners (defaults to HTTPS:443 with -tls if empty) |
| listenerSet.parentRef | object | {"name":"","namespace":""} | Reference to the parent Gateway |
| listenerSet.sectionName | string | "" | Optional listener name in the ListenerSet that the HTTPRoute should target |
| livenessProbe.enabled | bool | true | Liveness probe configuration |
| livenessProbe.failureThreshold | int | 3 | |
| livenessProbe.httpGet.path | string | "/" | |
| livenessProbe.httpGet.port | string | "http" | |
| livenessProbe.initialDelaySeconds | int | 90 | |
| livenessProbe.periodSeconds | int | 15 | |
| livenessProbe.timeoutSeconds | int | 15 | |
| mariadb | object | {"auth":{"database":"matomo","existingSecret":"","password":"change_me","rootPassword":"root_change_me","username":"matomo"},"containerSecurityContext":{"enabled":true,"readOnlyRootFilesystem":true,"runAsGroup":10001,"runAsUser":10001},"enabled":true,"networkPolicy":{"enabled":true},"podSecurityContext":{"enabled":true,"fsGroup":10001},"resources":{"limits":{"cpu":"500m","ephemeral-storage":"1Gi","memory":"512Mi"},"requests":{"cpu":"250m","ephemeral-storage":"50Mi","memory":"256Mi"}},"service":{"clusterIP":"None","type":"ClusterIP"}} | External chart mariabd : oci://registry-1.docker.io/cloudpirates/mariadb |
| mariadb.service | object | {"clusterIP":"None","type":"ClusterIP"} | PRODUCTION & SECURITY DEFAULTS (Required by Kube-Score) |
| nameOverride | string | "" | String to partially override fullname template |
| networkPolicy.egressRules | object | {"allowDns":true,"allowInternet":true,"extraEgress":[]} | Egress rules (Allow traffic to DNS and MySQL) |
| networkPolicy.enabled | bool | true | Enable NetworkPolicy for phpMyAdmin pods |
| networkPolicy.ingressRules | object | {"allowFromGatewayNamespace":false,"allowFromIngressNamespace":true,"allowInternal":true,"extraIngress":[],"gatewayNamespaceLabels":{"kubernetes.io/metadata.name":"envoy"},"ingressControllerNamespaceLabels":{"kubernetes.io/metadata.name":"kube-system"}} | Ingress rules (Allow traffic on HTTP port) |
| nodeSelector | object | {} | Node labels for pod assignment |
| persistence.accessMode | string | "ReadWriteOnce" | Access mode for the persistent volume |
| persistence.annotations | object | {} | Annotations for the persistent volume claim |
| persistence.enabled | bool | true | Enable persistent volume for matomo-data |
| persistence.size | string | "2Gi" | Size of the persistent volume |
| persistence.storageClassName | string | "default" | Storage class for the persistent volume |
| podAnnotations | object | {} | Annotations for the pods |
| podDisruptionBudget.enabled | bool | true | Enable PodDisruptionBudget for high availability during maintenance |
| podSecurityContext.fsGroup | int | 10001 | Group ID for volumes |
| podSecurityContext.runAsGroup | int | 10001 | Group ID for the pod processes |
| podSecurityContext.runAsNonRoot | bool | true | Enable privilege separation (non-root) |
| podSecurityContext.runAsUser | int | 10001 | User ID for the pod processes |
| readinessProbe.enabled | bool | true | Readiness probe configuration |
| readinessProbe.failureThreshold | int | 3 | |
| readinessProbe.httpGet.path | string | "/matomo.php" | |
| readinessProbe.httpGet.port | string | "http" | |
| readinessProbe.initialDelaySeconds | int | 45 | |
| readinessProbe.periodSeconds | int | 15 | |
| readinessProbe.timeoutSeconds | int | 15 | |
| redis | object | {"architecture":"standalone","containerSecurityContext":{"enabled":true,"readOnlyRootFilesystem":true,"runAsGroup":10001,"runAsUser":10001},"enabled":true,"networkPolicy":{"enabled":true},"podSecurityContext":{"enabled":true,"fsGroup":10001},"resources":{"limits":{"cpu":"100m","ephemeral-storage":"100Mi","memory":"128Mi"},"requests":{"cpu":"50m","ephemeral-storage":"50Mi","memory":"128Mi"}}} | External chart redis : oci://registry-1.docker.io/cloudpirates/redis |
| replicaCount | int | 1 | Number of desired pods |
| resources.limits | object | {"cpu":"1000m","ephemeral-storage":"1Gi","memory":"1Gi"} | Resource limits (CPU, Memory, Ephemeral Storage) |
| resources.requests | object | {"cpu":"500m","ephemeral-storage":"1Gi","memory":"512Mi"} | Resource requests (CPU, Memory, Ephemeral Storage) |
| securityContext.allowPrivilegeEscalation | bool | false | Disallow privilege escalation for the container |
| securityContext.capabilities | object | {"drop":["ALL"]} | Capabilities to drop for security hardening |
| securityContext.readOnlyRootFilesystem | bool | true | Mount the container's root filesystem as read-only |
| service.port | int | 80 | Service port |
| service.targetPort | int | 9000 | Target port |
| service.type | string | "ClusterIP" | Kubernetes Service type |
| serviceAccount.annotations | object | {} | Annotations to add to the ServiceAccount |
| serviceAccount.create | bool | true | Specifies whether a ServiceAccount should be created |
| serviceAccount.name | string | "" | The name of the ServiceAccount to use (generated if not set) |
| test.enabled | bool | true | |
| test.image | object | {"repository":"docker.io/library/busybox","tag":"1.36.1"} | Image for chart testing pods |
| test.livenessProbe | object | {} | Liveness probe for the test pod |
| test.readinessProbe | object | {} | Readiness probe for the test pod |
| test.securityContext | object | {"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"readOnlyRootFilesystem":true,"runAsGroup":10001,"runAsNonRoot":true,"runAsUser":10001} | Security context for the test pod |
| tolerations | list | [] | Tolerations for pod assignment |
Deploy matomo with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has matomo 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 chartmatomo is pinned at v1.5.1 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