Kubernetes Deployment
Kubernetes Deployment
This article details the configuration of a MediaWiki 1.40 deployment within a Kubernetes environment. This guide is intended for system administrators and DevOps engineers familiar with both MediaWiki and Kubernetes concepts. It outlines the key components and considerations for a robust and scalable deployment.
Overview
Deploying MediaWiki on Kubernetes offers significant advantages in terms of scalability, resilience, and manageability. Kubernetes allows for automated deployment, scaling, and operations of your application, reducing operational overhead. This guide covers the core aspects of setting up a production-ready MediaWiki cluster. We will focus on a separation of concerns approach, deploying each major component (web servers, database, message queue, etc.) as individual Kubernetes deployments and services.
Prerequisites
Before beginning, ensure you have the following:
- A running Kubernetes cluster (e.g., Minikube, Google Kubernetes Engine (GKE), Amazon Elastic Kubernetes Service (EKS), Azure Kubernetes Service (AKS)).
- `kubectl` command-line tool configured to access your cluster.
- A container registry (e.g., Docker Hub, Google Container Registry (GCR), Amazon Elastic Container Registry (ECR)) to store your container images.
- Basic familiarity with Kubernetes concepts like Pods, Deployments, Services, and ConfigMaps.
- A working understanding of ManualDatabaseSetup and ConfigurationSettings.
Architecture
A typical Kubernetes deployment for MediaWiki consists of the following components:
- Web Servers: Multiple replicas of the MediaWiki web server (using Apache or Nginx) serving user requests.
- Database: A persistent database (MySQL/MariaDB or PostgreSQL) running as a Kubernetes StatefulSet.
- Message Queue: A message queue (RabbitMQ or Redis) for handling asynchronous tasks like email sending and job processing.
- Object Storage: A persistent volume claim (PVC) for storing uploaded files.
- Caching: A caching layer (Memcached or Redis) to improve performance.
Component Details & Configuration
Database (MySQL/MariaDB)
The database is a critical component. We recommend using a StatefulSet to ensure data persistence and a stable network identity.
Parameter | Value | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
StatefulSet Name | `mediawiki-db` | Database Type | MySQL 8.0 (or MariaDB 10.6+) | Replicas | 3 (for high availability) | Storage Class | `standard` (adjust based on your cluster) | Storage Size | 50 GiB (adjust based on your needs) | Service Type | ClusterIP |
The database configuration should be stored in a ConfigMap and mounted as a volume in the database Pod. Refer to DatabaseConfiguration for details on configuring the database itself. Ensure proper DatabaseBackups are configured!
Web Servers (Apache)
The web servers handle incoming HTTP requests and serve the MediaWiki application.
Parameter | Value | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Deployment Name | `mediawiki-web` | Replicas | 3 (or more, scale as needed) | Image | `your-registry/mediawiki:1.40-apache` (replace with your image) | Service Type | LoadBalancer (or NodePort) | Port | 80 | ConfigMap | `mediawiki-config` |
A ConfigMap will contain the `LocalSettings.php` file, crucial for MediaWiki configuration. See ConfiguringLocalSettings for details. A service of type `LoadBalancer` will expose the web servers to the outside world. Consider using an HTTPSConfiguration for secure connections.
Message Queue (RabbitMQ)
A message queue is essential for handling background tasks. RabbitMQ is a popular choice.
Parameter | Value | ||||||||
---|---|---|---|---|---|---|---|---|---|
Deployment Name | `mediawiki-rabbitmq` | Replicas | 1 (or more, depending on load) | Image | `rabbitmq:3.9-management` | Service Type | ClusterIP | Port | 5672 |
Configure RabbitMQ to integrate with MediaWiki by setting the `$wgRabbitMQBrokerUrl` in `LocalSettings.php`. See MessageQueueConfiguration for assistance.
Object Storage (Persistent Volume Claim)
Uploaded files need a persistent storage solution. A Persistent Volume Claim (PVC) dynamically provisions storage.
- PVC Name: `mediawiki-files`
- Storage Class: `standard` (adjust based on your cluster)
- Storage Size: 20 GiB (adjust based on your needs)
Mount this PVC to the web server Pods under `/var/www/html/images`.
Service Discovery and Networking
Kubernetes Services provide a stable endpoint for accessing each component. Use ClusterIP services for internal communication between components. A LoadBalancer service exposes the web servers to external traffic. Consider using an IngressController for more advanced routing and TLS termination. Remember to configure the correct FirewallRules to allow traffic to the appropriate ports.
Scaling and Monitoring
Kubernetes allows for easy scaling of individual components. Monitor resource utilization (CPU, memory) using tools like Prometheus and Grafana. Configure horizontal pod autoscaling (HPA) to automatically adjust the number of web server replicas based on CPU load. Regularly review PerformanceTuning options.
Conclusion
Deploying MediaWiki on Kubernetes provides a scalable and resilient platform. This guide provides a starting point for setting up a production-ready deployment. Remember to tailor the configuration to your specific needs and environment. Refer to the official Kubernetes documentation and MediaWiki documentation for more detailed information. Consider automating the deployment process with tools like Helm or Kustomize for easier management and version control. Finally, explore SecurityBestPractices to ensure a secure and robust deployment.
Main Page ConfigurationSettings ManualDatabaseSetup DatabaseConfiguration ConfiguringLocalSettings MessageQueueConfiguration HTTPSConfiguration IngressController FirewallRules PerformanceTuning DatabaseBackups SecurityBestPractices Troubleshooting KubernetesNetworking DeploymentStrategies
Intel-Based Server Configurations
Configuration | Specifications | Benchmark |
---|---|---|
Core i7-6700K/7700 Server | 64 GB DDR4, NVMe SSD 2 x 512 GB | CPU Benchmark: 8046 |
Core i7-8700 Server | 64 GB DDR4, NVMe SSD 2x1 TB | CPU Benchmark: 13124 |
Core i9-9900K Server | 128 GB DDR4, NVMe SSD 2 x 1 TB | CPU Benchmark: 49969 |
Core i9-13900 Server (64GB) | 64 GB RAM, 2x2 TB NVMe SSD | |
Core i9-13900 Server (128GB) | 128 GB RAM, 2x2 TB NVMe SSD | |
Core i5-13500 Server (64GB) | 64 GB RAM, 2x500 GB NVMe SSD | |
Core i5-13500 Server (128GB) | 128 GB RAM, 2x500 GB NVMe SSD | |
Core i5-13500 Workstation | 64 GB DDR5 RAM, 2 NVMe SSD, NVIDIA RTX 4000 |
AMD-Based Server Configurations
Configuration | Specifications | Benchmark |
---|---|---|
Ryzen 5 3600 Server | 64 GB RAM, 2x480 GB NVMe | CPU Benchmark: 17849 |
Ryzen 7 7700 Server | 64 GB DDR5 RAM, 2x1 TB NVMe | CPU Benchmark: 35224 |
Ryzen 9 5950X Server | 128 GB RAM, 2x4 TB NVMe | CPU Benchmark: 46045 |
Ryzen 9 7950X Server | 128 GB DDR5 ECC, 2x2 TB NVMe | CPU Benchmark: 63561 |
EPYC 7502P Server (128GB/1TB) | 128 GB RAM, 1 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (128GB/2TB) | 128 GB RAM, 2 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (128GB/4TB) | 128 GB RAM, 2x2 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (256GB/1TB) | 256 GB RAM, 1 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (256GB/4TB) | 256 GB RAM, 2x2 TB NVMe | CPU Benchmark: 48021 |
EPYC 9454P Server | 256 GB RAM, 2x2 TB NVMe |
Order Your Dedicated Server
Configure and order your ideal server configuration
Need Assistance?
- Telegram: @powervps Servers at a discounted price
⚠️ *Note: All benchmark scores are approximate and may vary based on configuration. Server availability subject to stock.* ⚠️