Matomo on Kubernetes

null

We provide a comparison between: Docker Images, Helm Charts and a Kubernetes Operator.


Matomo recently published its major v5 release.

All important information about the upgrade process can be found in here:

Matomo v5 upgrade guide


Matomo is an open source web analytics platform that consists of the following components:

  1. Backend component written in PHP: github.com/matomo-org/matomo
  2. Relational database, e.g. MySQL or MariaDB
  3. Optional use of Redis for queued tracking and caching.

Matomo Docker for Kubernetes.

Matomo publishes Docker Images on GitHub (github.com/matomo-org/docker), which allow easy local installation. Using volumes, the initial configuration can be persisted.

Warning: When upgrading Matomo, the initial configuration will be overwritten and Matomo must be reconfigured again.

To solve this problem, it is necessary to check at each container startup if a database migration or initialization is necessary. In Kubernetes, this task can be handled by an InitCotainer. With the Matomo Plugin ExtraTools this action can be performed from the command line.

However, deploying the Matomo Docker image on Kubernetes is still quite laborious, as several components have to be configured manually (deployment, service, ingress).

In addition, an external (managed) database must be used and linked to the manual installation.

Matomo Helm Chart

Helm charts offer the possibility to summarize the manually configured components in a Chart. On the platform Artifact Hub multiple Matomo Helm Charts can be found.

However, these Helm charts still must be configured by the user. Often it must be defined in which configuration Matomo should be installed (e.g. with or without Redis). Before every update it still needs to be checked, whether the new images are still compatible with the existing volumes and data structure. A major upgrade of database versions is often not possible via Helm-Charts.

In summary, it can be said that Helm-Charts are a quick way to install Matomo, but in the long run it can lead to a significant effort.

Step-by-step instructions can be found here:

Matomo Kubernetes Operator

Another option for automatic installation and operation for Matomo on Kubernetes is a Kubernetes Operator. It not only can adjust the initial installation to the cloud infrastructure and needs of the customer, but also takes care of future updates. If needed an update of the Kubernetes Operator also initiates an automated update of Matomo. Additionally, Kubernetes Operators offer the ability to dynamically adjust the type of installation based on the load profile.

We at Glasskube have developed a Kubernetes operator for Matomo, which can be already previewed:

Make sure you are connected to a Kubernetes cluster and have helm installed.

The easiest way to install Glasskube is via its helm chart:

helm repo add glasskube https://charts.glasskube.eu/
helm repo update
helm install my-glasskube-operator glasskube/glasskube-operator

The full documentation can be found in our Getting started documentation.

Once the installation of the operator is complete, Matomo can now be installed. For this purpose the following custom resource must be installed:

Important A DNS entry must be set on the LoadBalancer or the Ingress Host. SSL certificates are automatically generated by LoadBalancer or cert-manager if a ClusterIssuer is configured.

Matomo.yaml

apiVersion: "glasskube.eu/v1alpha1"
kind: Matomo
metadata:
  name: matomo
  namespace: matomo
spec:
  host: matomo.hostname.tld # hostname
kubectl apply -f Matomo.yaml

Now the installation is complete. Updates to the Kubernetes operator will automatically update Matomo.

Screencast

Conclusion

Matomo can be installed in a Kubernetes cluster in several ways. An installation using the Docker image is helpful to learn more about Kubernetes without too many new technologies. An installation via Helm helps to deploy the needed resources much faster. A Kubernetes operator supports running Matomo in autopilot mode.

Glasskube Operator on GitHub

Support Glasskube
By leaving us a Star on GitHub
Star us
Glasskube Newsletter

Sign-Up to get the latest product updates and release notes!

Our solutions for reliable
and scalable infrastructure.

Easily and scale your IT infrastructure while deploying applications quickly and securely with our cloud native technology solutions.

Outdated software or technical debt?

Turn on autopilot