wordpress

by ScriptonBasestar

Helm chartv0.4.0App 6.8BSD-3-Clause

The world's most popular CMS - WordPress with MySQL/MariaDB

About this chart

WordPress Helm Chart

Production-ready WordPress deployment on Kubernetes with external MySQL support and Apache web server.

Features

  • WordPress Apache Image: Official WordPress with Apache HTTP Server
  • External Database: MySQL support (no embedded database)
  • Persistent Storage: Volume for WordPress content
  • Security: Running as non-root user (www-data)
  • Production Ready: Resource limits, health checks, and monitoring
  • Easy Configuration: Simple values-based configuration

Prerequisites

Deployment Scenarios

This chart includes three pre-configured deployment scenarios optimized for different use cases:

Home Server (values-home-single.yaml)

Minimal resources for personal servers, home labs, Raspberry Pi, or Intel NUC:

helm install wordpress-home charts/wordpress \
  -f charts/wordpress/values-home-single.yaml \
  --set mysql.external.password=your-db-password \
  --set mysql.external.host=mysql.default.svc.cluster.local

Resource allocation: 100-500m CPU, 256-512Mi RAM, 5Gi storage

Startup Environment (values-startup-single.yaml)

Balanced configuration for small teams, startups, and development environments:

helm install wordpress-startup charts/wordpress \
  -f charts/wordpress/values-startup-single.yaml \
  --set mysql.external.password=your-db-password \
  --set mysql.external.host=mysql.default.svc.cluster.local

Resource allocation: 250m-1000m CPU, 512Mi-1Gi RAM, 10Gi storage

Production HA (values-prod-master-replica.yaml)

High availability deployment with multiple replicas and monitoring:

helm install wordpress-prod charts/wordpress \
  -f charts/wordpress/values-prod-master-replica.yaml \
  --set mysql.external.password=your-db-password \
  --set mysql.external.host=mysql.default.svc.cluster.local

Features: 3 replicas, pod anti-affinity, HPA, PodDisruptionBudget, NetworkPolicy

Resource allocation: 500m-2000m CPU, 1-2Gi RAM, 20Gi storage per pod

For detailed comparison and configuration examples, see the Scenario Values Guide.

  • Kubernetes 1.19+
  • Helm 3.0+
  • External MySQL database
  • PersistentVolume support (for data persistence)
  • Ingress controller (for external access)

Quick Start

🏠 Home Server Quick Start

For home server or low-resource environments, use the optimized configuration:

# Use pre-configured home server values
helm install my-wordpress ./charts/wordpress -f charts/wordpress/values-homeserver.yaml

# Or customize it
cp charts/wordpress/values-homeserver.yaml my-values.yaml
# Edit my-values.yaml with your settings
helm install my-wordpress ./charts/wordpress -f my-values.yaml

Home Server Configuration includes:

  • Reduced resource limits (500m CPU, 512Mi RAM)
  • Optimized storage (5Gi default)
  • PHP memory optimizations
  • Security hardening
  • Performance tips and best practices

See values-homeserver.yaml for details.


1. Prepare External MySQL Database

Before installing WordPress, create a MySQL database:

CREATE DATABASE wordpress CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wordpress'@'%' IDENTIFIED BY 'your-secure-password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'%';
FLUSH PRIVILEGES;

2. Create Values File

Create a my-values.yaml file:

# WordPress configuration
wordpress:
  title: "My WordPress Site"
  siteUrl: "https://myblog.example.com"
  homeUrl: "https://myblog.example.com"

  admin:
    username: "admin"
    password: "YourSecurePassword123!"
    email: "[email protected]"

# External MySQL configuration
mysql:
  external:
    enabled: true
    host: "mysql-service.default.svc.cluster.local"
    port: 3306
    database: "wordpress"
    username: "wordpress"
    password: "your-secure-password"

# Ingress configuration
ingress:
  enabled: true
  className: "nginx"
  hosts:
    - host: myblog.example.com
      paths:
        - path: /
          pathType: Prefix
  tls:
    - secretName: wordpress-tls
      hosts:
        - myblog.example.com

# Storage configuration
persistence:
  content:
    size: 20Gi

3. Install the Chart

# Install WordPress
helm install myblog ./wordpress -f my-values.yaml

# Or upgrade if already installed
helm upgrade --install myblog ./wordpress -f my-values.yaml

4. Access WordPress

# Check the deployment status
kubectl get pods -l app.kubernetes.io/name=wordpress

# Get the Ingress URL
kubectl get ingress -l app.kubernetes.io/name=wordpress

# Access via browser
https://myblog.example.com

Configuration

WordPress Settings

ParameterDescriptionDefault
wordpress.titleWordPress site title"My WordPress Site"
wordpress.siteUrlWordPress site URL"https://wordpress.example.com"
wordpress.homeUrlWordPress home URL"https://wordpress.example.com"
wordpress.admin.usernameAdmin username"admin"
wordpress.admin.passwordAdmin password (required)""
wordpress.admin.emailAdmin email"[email protected]"
wordpress.debugEnable debug mode"false"
wordpress.tablePrefixDatabase table prefix"wp_"

Image Configuration

ParameterDescriptionDefault
image.repositoryWordPress image repositorywordpress
image.tagImage tag"6.4.3-apache"
image.pullPolicyImage pull policyIfNotPresent

External MySQL

ParameterDescriptionDefault
mysql.external.enabledEnable external MySQLtrue
mysql.external.hostMySQL host""
mysql.external.portMySQL port3306
mysql.external.databaseDatabase name"wordpress"
mysql.external.usernameDatabase username"wordpress"
mysql.external.passwordDatabase password""
mysql.external.existingSecret.enabledUse existing secretfalse

Persistent Storage

ParameterDescriptionDefault
persistence.enabledEnable persistencetrue
persistence.content.enabledEnable content volumetrue
persistence.content.sizeContent volume size10Gi
persistence.content.storageClassStorage class"" (default)
persistence.content.existingClaimUse existing PVC""

Ingress

ParameterDescriptionDefault
ingress.enabledEnable ingressfalse
ingress.classNameIngress class name"nginx"
ingress.annotationsIngress annotationsSee values.yaml
ingress.hostsIngress hosts configuration[]
ingress.tlsIngress TLS configuration[]

Resources

ParameterDescriptionDefault
resources.limits.cpuCPU limit1000m
resources.limits.memoryMemory limit1Gi
resources.requests.cpuCPU request250m
resources.requests.memoryMemory request256Mi

Advanced Configuration

Using Existing Secrets

Instead of putting passwords in values.yaml, you can use existing Kubernetes secrets:

mysql:
  external:
    existingSecret:
      enabled: true
      secretName: "mysql-credentials"
      usernameKey: "username"
      passwordKey: "password"
      databaseKey: "database"

Create the secret:

kubectl create secret generic mysql-credentials \
  --from-literal=username=wordpress \
  --from-literal=password=your-secure-password \
  --from-literal=database=wordpress

Using Existing PVC

If you already have a PersistentVolumeClaim:

persistence:
  content:
    existingClaim: "my-wordpress-content-pvc"

WordPress Salts and Keys

For enhanced security, generate WordPress salts and keys:

wordpress:
  salts:
    authKey: "put-unique-phrase-here"
    secureAuthKey: "put-unique-phrase-here"
    loggedInKey: "put-unique-phrase-here"
    nonceKey: "put-unique-phrase-here"
    authSalt: "put-unique-phrase-here"
    secureAuthSalt: "put-unique-phrase-here"
    loggedInSalt: "put-unique-phrase-here"
    nonceSalt: "put-unique-phrase-here"

Generate them at: https://api.wordpress.org/secret-key/1.1/salt/

Installing Plugins and Themes

You can configure plugins and themes to be installed during initialization:

wordpress:
  plugins:
    install:
      - woocommerce
      - contact-form-7
      - jetpack
    activate:
      - woocommerce
      - contact-form-7

  themes:
    install:
      - twentytwentyfour
      - astra
    activate: twentytwentyfour

Custom Environment Variables

Add custom environment variables:

extraEnv:
  - name: WORDPRESS_CONFIG_EXTRA
    value: |
      define('WP_MEMORY_LIMIT', '256M');
      define('WP_MAX_MEMORY_LIMIT', '512M');
      define('FORCE_SSL_ADMIN', true);

High Availability & Security

WordPress chart supports production-grade high availability and security features:

HorizontalPodAutoscaler

Automatically scale WordPress pods based on CPU and memory usage:

autoscaling:
  enabled: true
  minReplicas: 2
  maxReplicas: 10
  targetCPUUtilizationPercentage: 70
  targetMemoryUtilizationPercentage: 80

Benefits:

  • Automatically handles traffic spikes
  • Scales down during low traffic to save resources
  • Ensures consistent performance under varying loads

Requirements:

  • Metrics Server installed in cluster
  • ReadWriteMany (RWX) storage for multi-replica deployments

PodDisruptionBudget

Ensures minimum availability during voluntary disruptions (node drains, updates, etc.):

podDisruptionBudget:
  enabled: true
  minAvailable: 1
  # Alternative: maxUnavailable: 1

Benefits:

  • Prevents complete service outage during cluster maintenance
  • Controls the rate of pod evictions
  • Improves service reliability during rolling updates

Use Cases:

  • Cluster upgrades without downtime
  • Node maintenance with guaranteed availability
  • Controlled rollout of configuration changes

NetworkPolicy

Restricts network access to WordPress pods for enhanced security:

networkPolicy:
  enabled: true
  ingress:
    # Allow traffic from ingress controller
    - from:
        - namespaceSelector:
            matchLabels:
              name: ingress-nginx
      ports:
        - protocol: TCP
          port: 80
  egress:
    # Allow DNS resolution
    - to:
        - namespaceSelector:
            matchLabels:
              name: kube-system
      ports:
        - protocol: UDP
          port: 53
    # Allow MySQL database access
    - to:
        - podSelector:
            matchLabels:
              app.kubernetes.io/name: mysql
      ports:
        - protocol: TCP
          port: 3306

Benefits:

  • Zero-trust network security model
  • Prevents lateral movement in case of compromise
  • Compliance with security best practices

Requirements:

  • CNI plugin with NetworkPolicy support (Calico, Cilium, etc.)
  • Proper namespace and pod labels configured

ServiceMonitor

Enable Prometheus metrics collection for monitoring:

monitoring:
  serviceMonitor:
    enabled: true
    path: /
    interval: 30s
    scrapeTimeout: 10s
    additionalLabels:
      prometheus: kube-prometheus

Benefits:

  • Real-time visibility into WordPress performance
  • Historical data for capacity planning
  • Integration with alerting systems

Requirements:

  • Prometheus Operator installed in cluster
  • ServiceMonitor CRD available

Production Configuration Parameters

ParameterDescriptionDefault
autoscaling.enabledEnable HorizontalPodAutoscalerfalse
autoscaling.minReplicasMinimum number of replicas1
autoscaling.maxReplicasMaximum number of replicas5
autoscaling.targetCPUUtilizationPercentageTarget CPU utilization80
autoscaling.targetMemoryUtilizationPercentageTarget memory utilization80
podDisruptionBudget.enabledEnable PodDisruptionBudgetfalse
podDisruptionBudget.minAvailableMinimum available pods1
podDisruptionBudget.maxUnavailableMaximum unavailable pods""
networkPolicy.enabledEnable NetworkPolicyfalse
networkPolicy.ingressIngress rules[]
networkPolicy.egressEgress rules[]
monitoring.serviceMonitor.enabledEnable ServiceMonitorfalse
monitoring.serviceMonitor.pathMetrics endpoint path/
monitoring.serviceMonitor.intervalScrape interval30s
monitoring.serviceMonitor.scrapeTimeoutScrape timeout10s

Complete Production Example

See values-example.yaml for a complete production-ready configuration with all HA features enabled.

Maintenance

Backup

Backup your PersistentVolume and database regularly:

# Backup WordPress content
kubectl exec -it <wordpress-pod> -- tar czf /tmp/wordpress-backup.tar.gz /var/www/html

# Backup database
kubectl exec -it <mysql-pod> -- mysqldump -u wordpress -p wordpress > wordpress-db-backup.sql

Upgrade WordPress

# Update image tag in values.yaml
image:
  tag: "6.5.0-apache"

# Upgrade the release
helm upgrade myblog ./wordpress -f my-values.yaml

# Check upgrade status
kubectl logs -f <wordpress-pod>

Scaling

Adjust replicas for high availability:

replicaCount: 3

# Note: Requires ReadWriteMany (RWX) storage class
persistence:
  content:
    accessMode: ReadWriteMany

Troubleshooting

Check Pod Status

kubectl get pods -l app.ku

Deploy wordpress with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has wordpress 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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartwordpress is pinned at v0.4.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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