wordpress

by SlyBase

Helm chartv5.8.2App 7.0.1MITVerified publisher

Using the official WordPress image. This chart provides automation for installation, user management, plugin installation, and metrics.

About this chart

WordPress - Helm Chart for Kubernetes

Introduction

This Helm chart installs WordPress in a Kubernetes cluster with many advanced features. It is based on the official WordPress image and provides automation for installation, user management, plugin installation, and metrics for prometheus (WordPress and Apache).

TL;DR

You can find different sample YAML files (external database, integrated MariaDB and advanced configuration) in the GitHub repo in the subfolder "samples".

Note: No default site is set as "Home", so you will see no landing page. You have to log in to /wp-admin to install a theme.

Installation with integrated MariaDB chart

# ./samples/mariaDB.secrets.yaml
apiVersion: v1
kind: Secret
metadata:
  name: wordpress-test-secret
type: Opaque
stringData:
  wordpress.username: admin
  wordpress.password: S3cr3tP@ssw0rd
  wordpress.email: [email protected]
  mariadb-root-password: S3cureDBP@ss
  mariadb-password: Sup3rS3cureP@ss
# ./samples/mariaDB.values.yaml
wordpress:
  init:
    enabled: true
    existingSecret: "wordpress-test-secret"
    title: "My WordPress Site"
  url: "https://example.com"
mariadb:
  auth:
    database: "wordpress_db"
    username: "wordpress_db_user"
    existingSecret: "wordpress-test-secret"

Install with Helm:

kubectl apply -f ./samples/mariaDB.secrets.yaml
helm install wordpress oci://ghcr.io/slybase/charts/wordpress --values ./samples/mariaDB.values.yaml

Features

Automatic WordPress Installation

  • Init Container: Automatic initial installation of WordPress with predefined admin credentials.
  • Configuration: Set admin username, password, email, first name, last name, and blog title.
  • Debug Mode: Enable debugging for the installation.
  • Permalinks: Configure permalink structures (e.g., post name, day and name).

What wordpress.init.enabled does

The chart's init containers always run on every pod start — they manage plugins, themes, MU-plugins, .htaccess and configuration regardless of this setting. wordpress.init.enabled only controls the automatic WordPress core installation step inside the init container:

  • true: On first start the init container runs wp core install with the configured admin credentials, blog title and (optionally) multisite setup. It is idempotent — if WordPress is already installed, the installation is skipped, but language, permalinks and admin metadata (first/last name) are still applied.
  • false (default): No automatic installation. The chart expects a database with an already-installed WordPress (e.g. a migration or an external/restored database). If the WordPress tables are missing, the init container fails fast with instructions instead of starting an unconfigured site — the pod will not become ready until either wordpress.init.enabled=true is set or the database is provisioned. Note that wordpress.language, wordpress.permalinks.* and the wordpress.init.* admin settings are not applied in this mode.

For a fresh installation you therefore effectively need wordpress.init.enabled: true together with admin credentials (either wordpress.init.username/password/email or wordpress.init.existingSecret).

User Management

  • Automatic User Generation: Create additional users with roles (Administrator, Editor, etc.).
  • Email Notification: Automatically send emails with generated passwords.

Language

  • Language: Set the WordPress language (e.g., de_DE for German).

Plugin Installation

  • Automatic Installation: Install plugins from WordPress.org, local ZIPs, URLs, or Composer packages.
  • Composer Support: Install plugins via Composer (e.g., humanmade/s3-uploads) that aren't available in WordPress.org.
  • Versioning: Specify plugin versions (WordPress.org and Composer syntax supported).
  • Activation and Auto-Updates: Activate plugins after installation and enable auto-updates.

Theme Installation

  • Automatic Installation: Install themes from WordPress.org, local ZIPs, URLs, or Composer packages.
  • Composer Support: Install themes via Composer (e.g., wpackagist-theme/astra).
  • Versioning: Specify theme versions (WordPress.org and Composer syntax supported).
  • Activation and Auto-Updates: Activate themes after installation and enable auto-updates.
  • Custom Themes: Support for custom theme ZIPs via direct URLs.

WordPress Multisite

  • Subdirectory and Subdomain modes: Configure multisite with either example.com/blog or blog.example.com style URLs.
  • Automatic Site Creation: Define sub-sites declaratively in values and they are created/updated on every init.
  • Network-wide Plugin/Theme Activation: Use networkActivate for plugins or networkEnable for themes to make them available across all sites.
  • Independent Main Site and Sub-Site Control: activate controls the main site, sites[] controls sub-sites — both can be combined.
  • Per-Site User Roles: Assign users to specific sub-sites with individual roles.
  • Site Pruning: Optionally archive sites not defined in the configuration.
  • URL Plugin/Theme Slug Override: Use the slug property for URL-based plugins/themes to enable full feature support (autoupdate, sites, network activation).

Database

  • External Database: Use an external MariaDB/MySQL database.
  • Embedded MariaDB: Enable the integrated MariaDB chart for local database.
  • Memcached: Enable Memcached for caching.
  • Redis: Enable Redis as alternative caching.
  • Valkey: Enable Valkey (Redis fork) as alternative caching.

High Availability / Workload Controller

Two first-class HA models — pick based on whether you have RWX storage:

ModelHowWhen
StatefulSet + per-Pod RWOcontrollerType: statefulset — each replica gets its own ReadWriteOnce volume via volumeClaimTemplates. A storage outage affects at most one replica (no shared RWX share-manager SPOF). Adds a headless Service and statefulset.* tunables (podManagementPolicy, updateStrategy, persistentVolumeClaimRetentionPolicy).No RWX available, or you want to avoid a shared-storage single point of failure. See samples/ha-statefulset.values.yaml.
Deployment + RWX + ephemeral corecontrollerType: deployment + storage.mode: wp-content — the WordPress core is re-copied from the image onto an emptyDir each start (pods become stateless and freely reschedulable), and only wp-content is persisted on one ReadWriteMany volume shared by all replicas.You have an RWX storage class (NFS, CephFS, Longhorn RWX, JuiceFS, …) and want shared wp-content. See samples/ha-deployment-rwx.values.yaml.
  • storage.mode: full (default — one volume for all of /var/www/html) or wp-content (ephemeral emptyDir core + persistent wp-content). wp-content mode pairs well with an object cache and offloaded uploads for truly stateless pods.
  • Consistent auth keys/salts: for per-Pod (statefulset) and ephemeral-core (storage.mode: wp-content) layouts the chart auto-generates and persists the eight WordPress AUTH_KEY/SALT values in its Secret and injects them into every Pod, so login cookies remain valid across replicas and restarts. Default full-mode Deployments are unchanged (their single shared wp-config.php already has consistent salts).
  • Multi-replica checklist (see the HA samples): enable an object cache (memcached/redis/valkey) so sessions/transients are shared; set resources.requests (required for the HPA); add a podDisruptionBudget, podAntiAffinity and topologySpreadConstraints to spread replicas; and for Deployments set updateStrategy.type: RollingUpdate (the default is Recreate, which causes downtime on upgrades).

Metrics and Monitoring

  • WordPress Metrics: Automatically install a WordPress Plugin for Prometheus metrics.
    • See details on GitHub Repo of (SlyMetrics Plugin from slydlake)[https://github.com/slydlake/slymetrics]
  • Apache Metrics: Sidecar container for Apache metrics.
    • See details on GitHub Repo of (apache exporter from Lusitaniae)[https://github.com/Lusitaniae/apache_exporter]
  • Grafana Dashboard: Automatically deploy Grafana dashboard for WordPress metrics visualization.
    • Requires Grafana with dashboard sidecar (e.g., kube-prometheus-stack)
    • Automatically discovered via grafana_dashboard: "1" labe

Additional Configuration Files in values

  • Custom wp-config.php: Additional constants like WP_MEMORY_LIMIT.
  • .htaccess Configuration: Customize Apache URL rewriting and directives via wordpress.htaccess.
  • Apache Default Site Config: Modify /etc/apache2/sites-available/000-default.conf using apache.customDefaultSiteConfig.
  • Apache Ports Config: Adjust /etc/apache2/ports.conf with apache.customPortsConfig.
  • Apache PHP Config: Set PHP settings like upload limits via apache.customPhpConfig.
  • PHP OPcache: tuned OPcache defaults ship enabled (apache.opcache.*, rendered as the zz-opcache.ini conf.d drop-in) — bigger opcode cache and file table than the image's opcache-recommended.ini (128 MB / 4000 files), which matters once WordPress runs many plugins. The zz- prefix makes it load last, so its values are authoritative — tune via apache.opcache.* (set apache.opcache.enabled: false to fall back to the image defaults). On shared/network filesystems, raise apache.opcache.revalidateFreq to reduce stat() load.
  • Debug logging: wordpress.debug enables WP_DEBUG; wordpress.debugDisplay (default false) keeps PHP warnings out of the response body in production, and wordpress.debugLog (default false) writes them to wp-content/debug.log instead.

Custom commands in init container

  • Execute custom shell commands after init.sh via ConfigMap (wordpress.init.customInitConfigMap.name)
  • Perfect for custom setup tasks like updating plugins or creating pages
  • Configure with name and optional key (defaults to "commands.sh")
  • See samples/customInit.configmap.yaml and samples/customInit.values.yaml

MU-Plugins (Must-Use Plugins)

  • Deploy MU-Plugins via ConfigMaps - automatically activated PHP code that cannot be deactivated
  • Each ConfigMap data key becomes a PHP file in wp-content/mu-plugins/
  • Reference multiple ConfigMaps in wordpress.muPluginsConfigMaps
  • See samples/muPlugins.configmap.yaml and samples/muPlugins.values.yaml

SMTP

  • MU-plugin based: A PHP MU-plugin is generated from chart values and mounted directly into wp-content/mu-plugins/ — no external plugin installation needed and always current on rolling updates.
  • Forces PHPMailer to use the configured SMTP server for all outgoing WordPress mail.
  • Credentials (password, username, from-address) are read from a Kubernetes Secret at runtime — nothing sensitive in values.
  • See samples/smtp.values.yaml and samples/smtp.secrets.yaml

NetworkPolicy

  • Automatic traffic restriction: Generates a NetworkPolicy for the WordPress pod when networkPolicy.enabled: true.
  • DB egress auto-wired to the MariaDB subchart or externalDatabase.host.
  • Cache egress auto-wired to whichever backend is active (Memcached, Redis, or Valkey).
  • DNS egress (UDP/TCP 53) always included.
  • Optional internet egress (allowExternalEgress) for wp-cli plugin downloads and SMTP.
  • Ingress from rules and extra egress rules are fully configurable.
  • See samples/networkpolicy.values.yaml

PrometheusRule

  • Bundled alerting rules: Creates a PrometheusRule resource when metrics.prometheusRule.enabled: true (requires metrics.apache.enabled or metrics.wordpress.enabled).
  • Default alerts: WordPressPodDown, WordPressApacheExporterScrapeFailing, WordPressApacheHighBusyWorkers.
  • Configurable additionalLabels to match your Prometheus Operator ruleSelector.
  • Extend with extraRules or disable individual default rules via defaultRules.*.
  • See samples/prometheusrule.values.yaml

Secondary Ingress

  • Multiple Ingress objects from one release: ingress.secondary[] generates additional Ingress resources alongside the primary one.
  • Typical use-case: separate wp-admin Ingress with IP allowlist and a different TLS certificate.
  • Each secondary entry supports its own className, annotations, hosts, and tls.
  • Annotations are merged with commonAnnotations (entry-specific wins).
  • See samples/secondary-ingress.values.yaml

Backup CronJob

  • Scheduled database backup to a PVC: a CronJob runs mariadb-dump and compresses the output with gzip.
  • Optional file backup (backup.includeFiles: true) tars wp-content — only enable when your PVC supports multiple concurrent readers (RWX or VolumeSnapshot). Leave false for RWO storage (default).
  • Optional S3 sync via rclone sidecar (backup.s3.enabled): after the dump completes the rclone container syncs the timestamped folder to any S3-compatible bucket.
  • Backup PVC is annotated helm.sh/resource-policy: keep — it survives helm uninstall.
  • See samples/backup.values.yaml and samples/backup-s3.secrets.yaml

Backup restore

  • One-shot restore Job (backup.restore.enabled) replays a backup created by the CronJob: it restores the database dump (and wp-content when the backup included files).
  • Runs as a Helm pre-upgrade hook so it completes against the running database before the new WordPress pods roll.
  • Restores from the backup PVC (default) or pulls the backup from S3 first (backup.restore.fromS3: true).
  • Pick a backup with backup.restore.timestamp (the YYYYMMDD-HHMMSS folder), or leave it empty to restore the newest. Set backup.restore.enabled: false again after a successful restore so it does not re-run on the next upgrade.

VolumeSnapshot

  • Declarative CSI VolumeSnapshot (backup.volumeSnapshot.enabled) of the W

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 v5.8.2 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