docs/main/administration-guide/upgrade/upgrade-mattermost-kubernetes-ha.mdx
This guide provides a resilient and comprehensive strategy for upgrading Mattermost deployments managed via Kubernetes and the Mattermost Operator, including High Availability (HA) and optional Active/Active failover configurations. It outlines best practices to ensure zero downtime, minimize service risk, and provide robust fallback mechanisms.
Mattermost uses Kubernetes for container orchestration, deployed and managed via Helm charts and the Mattermost Operator. This model enables scalable, highly available, and automatically managed application lifecycles.
The Mattermost Operator handles the upgrade process automatically, ensuring that pods are updated incrementally and that traffic is routed correctly throughout the upgrade. If an error occurs during the upgrade, the Operator will not apply any changes, allowing you to investigate and resolve the issue or manually roll back without impacting the live environment. See the Downgrade Mattermost Server documentation for rollback details.
Health monitoring ensures that only healthy pods are replaced, and new pods are brought online only after passing health checks. New pods are deployed with the updated version, while old pods are gracefully terminated.
In High Availability (HA) cluster-based deployments, Mattermost runs multiple application servers in a cluster. This configuration ensures that if one server fails, others can continue to serve requests without downtime. User traffic load balancing is managed with services such as NGINX Ingress or HAProxy. PostgreSQL and file storage are deployed with replication for redundancy and failover.
An Active/Active configuration is optional and consists of two or more Mattermost clusters running concurrently across geographically distributed regions or availability zones. Each cluster is capable of serving live user traffic and processing requests independently while remaining in sync with shared backend components such as the database and file storage.
Key benefits for enterprise customers include:
These deployments require careful configuration management and coordination to ensure data consistency, upgrade safety, and seamless traffic failover. These clusters must maintain configuration/data consistency and require coordinated upgrades. See the Active/Active upgrade considerations section for recommendations.
This phase ensures your environment is healthy, backed up, and ready for an upgrade. Follow each step carefully to avoid disruptions and to ensure rollback readiness.
bashkubectl get nodes kubectl get pods --all-namespaces
bashhelm repo update helm upgrade mattermost-operator mattermost/mattermost-operator -n <OPERATOR_NAMESPACE_HERE> -f <OPTIONAL_CUSTOM_VALUES_HERE>
bashkubectl get deployment mattermost-operator -n mattermost -o=jsonpath='{.spec.template.spec.containers[0].image}'
bashkubectl top nodes kubectl describe node | grep Allocatable
Back up database and file storage.
Use
pg_dumpor volume snapshots to create a full backup to a secure, external location (e.g., S3 or NFS). Validate the backup can be restored. See the Backup and Disaster Recovery documentation for details.
Ensure configuration consistency: Validate that values.yaml, secrets, and other configuration files are version-controlled and consistent across all clusters (required for Active/Active deployments). Use tools like GitOps or configuration management systems to ensure all clusters have the same configuration.
We strongly recommend performing a dry run by testing the upgrade in a staging environment that mirrors production to catch misconfigurations early.
This step involves updating the Mattermost Operator and Mattermost server to a new version. The Operator manages the upgrade process, ensuring that pods are updated incrementally and that traffic is routed correctly throughout the upgrade.
We recommend having a separate Mattermost custom resource. See the Deploy Mattermost on Kubernetes documentation for details.
version field in your mattermost-installation.yaml file by replacing the <new-version-tag> with the specific version you are upgrading to:yamlapiVersion: installation.mattermost.com/v1beta1 kind: Mattermost metadata: name: <INSTALLATION_NAME_HERE> spec: version: <new-version-tag> # Update this fieldAlternatively, if you're using Helm
values.yamldirectly, update it with the desired Mattermost version:yamlimage: repository: mattermost/mattermost-enterprise-edition tag: <new-version-tag>
For Mattermost custom resource deployments:
bashkubectl apply -f mattermost-installation.yamlFor Helm values deployments:
bashhelm upgrade mattermost mattermost/mattermost-operator -f values.yaml
bashkubectl get pods -n mattermost kubectl logs -f <pod-name> -n mattermost
New pods are started with the updated version. Old pods are gracefully terminated after health checks pass, and traffic remains uninterrupted due to rolling upgrade behavior. NGINX, HAProxy, or Ingress configurations continue routing traffic seamlessly during the upgrade process.
When your deployment includes an Active/Active configuration with multi-cluster or multi-region deployments, you must ensure that all clusters are upgraded in a coordinated manner to maintain data consistency and service availability.
For coordinated site upgrades, we recommend the following steps:
To prevent split-brain scenarios during upgrades and ensure data consistency:
After the upgrade:
bashkubectl get pods -n mattermost -o=jsonpath='{.items[*].spec.containers[*].image}'
- Log in to the Mattermost web interface and navigate across teams and channels.
- Test core functionalities such as posting messages and uploading files.
- Verify that all integrations, webhooks, and plugins are functioning as expected.
- Check for error messages in the logs.
In case of upgrade issues, rollback should be performed by modifying the custom resource and setting the Mattermost version back to its original value.
For Mattermost custom resource deployments, update the version field in your mattermost-installation.yaml file to the previous version:
apiVersion: installation.mattermost.com/v1beta1
kind: Mattermost
metadata:
name: <INSTALLATION_NAME_HERE>
spec:
version: <previous-version-tag> # Set back to previous version
Then apply the rollback:
kubectl apply -f mattermost-installation.yaml
Alternatively, for Helm values deployments, use Helm's rollback command:
helm rollback mattermost <revision_number>
Restore your PostgreSQL database and file store backups if needed. Refer to the Backup and Disaster Recovery documentation for detailed guidance.
A successful upgrade is indicated by:
We recommend monitoring the following key metrics after an upgrade:
We strongly recommend deploying a separate staging environment that mirrors production, and running a full end-to-end upgrade simulation before upgrading live production clusters.
Upgrade the Operator first. Validate it’s stable before upgrading the Mattermost server version.
Mattermost does not upgrade the database schema by default. You must manually apply database schema updates if required by a newer Mattermost version. Review the Mattermost Server changelog for any migration steps.
Check the Operator logs and pod events using kubectl to identify and resolve issues. Look for common issues such as resource constraints, configuration errors, or network connectivity problems.
Running an older Operator version may not support newer Mattermost features or upgrade flows. Always check the Helm chart release notes for version compatibility between the Operator and the Mattermost server.
Yes. You can manage upgrades using tools like ArgoCD or FluxCD to apply Helm changes from version-controlled values.yaml files. Ensure changes are peer-reviewed and validated in staging before promotion.