wordpress
by SlyBase
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 runswp core installwith 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 eitherwordpress.init.enabled=trueis set or the database is provisioned. Note thatwordpress.language,wordpress.permalinks.*and thewordpress.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/blogorblog.example.comstyle URLs. - Automatic Site Creation: Define sub-sites declaratively in values and they are created/updated on every init.
- Network-wide Plugin/Theme Activation: Use
networkActivatefor plugins ornetworkEnablefor themes to make them available across all sites. - Independent Main Site and Sub-Site Control:
activatecontrols 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
slugproperty 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:
| Model | How | When |
|---|---|---|
| StatefulSet + per-Pod RWO | controllerType: 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 core | controllerType: 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) orwp-content(ephemeralemptyDircore + persistentwp-content).wp-contentmode 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 WordPressAUTH_KEY/SALTvalues in its Secret and injects them into every Pod, so login cookies remain valid across replicas and restarts. Defaultfull-mode Deployments are unchanged (their single sharedwp-config.phpalready 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 apodDisruptionBudget,podAntiAffinityandtopologySpreadConstraintsto spread replicas; and for Deployments setupdateStrategy.type: RollingUpdate(the default isRecreate, 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.confusingapache.customDefaultSiteConfig. - Apache Ports Config: Adjust
/etc/apache2/ports.confwithapache.customPortsConfig. - Apache PHP Config: Set PHP settings like upload limits via
apache.customPhpConfig. - PHP OPcache: tuned OPcache defaults ship enabled (
apache.opcache.*, rendered as thezz-opcache.iniconf.d drop-in) — bigger opcode cache and file table than the image'sopcache-recommended.ini(128 MB / 4000 files), which matters once WordPress runs many plugins. Thezz-prefix makes it load last, so its values are authoritative — tune viaapache.opcache.*(setapache.opcache.enabled: falseto fall back to the image defaults). On shared/network filesystems, raiseapache.opcache.revalidateFreqto reducestat()load. - Debug logging:
wordpress.debugenablesWP_DEBUG;wordpress.debugDisplay(defaultfalse) keeps PHP warnings out of the response body in production, andwordpress.debugLog(defaultfalse) writes them towp-content/debug.loginstead.
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
nameand optionalkey(defaults to "commands.sh") - See
samples/customInit.configmap.yamlandsamples/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.yamlandsamples/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.yamlandsamples/smtp.secrets.yaml
NetworkPolicy
- Automatic traffic restriction: Generates a
NetworkPolicyfor the WordPress pod whennetworkPolicy.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
fromrules and extra egress rules are fully configurable. - See
samples/networkpolicy.values.yaml
PrometheusRule
- Bundled alerting rules: Creates a
PrometheusRuleresource whenmetrics.prometheusRule.enabled: true(requiresmetrics.apache.enabledormetrics.wordpress.enabled). - Default alerts:
WordPressPodDown,WordPressApacheExporterScrapeFailing,WordPressApacheHighBusyWorkers. - Configurable
additionalLabelsto match your Prometheus OperatorruleSelector. - Extend with
extraRulesor disable individual default rules viadefaultRules.*. - 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-adminIngress with IP allowlist and a different TLS certificate. - Each secondary entry supports its own
className,annotations,hosts, andtls. - Annotations are merged with
commonAnnotations(entry-specific wins). - See
samples/secondary-ingress.values.yaml
Backup CronJob
- Scheduled database backup to a PVC: a
CronJobrunsmariadb-dumpand compresses the output with gzip. - Optional file backup (
backup.includeFiles: true) tarswp-content— only enable when your PVC supports multiple concurrent readers (RWX or VolumeSnapshot). Leavefalsefor 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 surviveshelm uninstall. - See
samples/backup.values.yamlandsamples/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 (andwp-contentwhen the backup included files). - Runs as a Helm
pre-upgradehook 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(theYYYYMMDD-HHMMSSfolder), or leave it empty to restore the newest. Setbackup.restore.enabled: falseagain 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartwordpress is pinned at v5.8.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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