How to deploy WordPress on Cloider Kubernetes Engine
Deploy WordPress with a managed MySQL database to a Cloider Kubernetes cluster: the official image, two replicas sharing a wp-content volume, and a free HTTPS subdomain, from the dashboard, the cloider CLI or an AI coding agent, with a screenshot of every step.

On this page
Key takeaways
- WordPress itself comes from the official image; only wp-content lives on a ReadWriteMany volume that every replica mounts.
- Set all eight keys and salts in a Secret, or each replica signs login cookies differently and logs you out.
- Pods reach the managed MySQL database on its private host, encrypted with MYSQL_CLIENT_FLAGS.
- A target serves the Service on a free cloider.app subdomain with HTTPS, no Ingress needed.
- Update WordPress by changing the image tag; plugins and themes still update from its dashboard.
WordPress runs more websites than any other content management system. The classic setup is one server with PHP, MySQL and the uploads on its disk. Run it on Kubernetes instead and you get several replicas behind one address, rolling updates without downtime, and the same setup on every environment. Cloider Kubernetes gives you a managed cluster in a couple of minutes, with no control plane or nodes to look after, and a managed MySQL database next to it.
In this guide you deploy WordPress with a MySQL database to a Cloider Kubernetes cluster, three ways:
The classic way, from the dashboard: create the cluster and the database, apply the Kubernetes manifests, put the site on a free subdomain and install WordPress.
With the cloider CLI: the same in a few commands, without a password on screen.
With an AI coding agent: "using cloider cli deploy wordpress to cloider kubernetes engine".
Options 1 and 2 show every step with a screenshot. Your site ends up on a free subdomain with HTTPS, <subdomain>.cloider.app, running two replicas of the official WordPress image.
What you need
A Cloider account. New accounts get a welcome credit.
kubectl, and for option 2 the cloider CLI andjq.A folder with the four manifests below in a
k8s/subfolder. Step 4 of option 1 shows each one.
File | What it creates |
|---|---|
k8s/config.yaml | ConfigMaps wordpress-config (the site address and the database TLS setting) and wordpress-php (upload limits) |
k8s/content.yaml | PersistentVolumeClaim wp-content: a 5 GiB ReadWriteMany volume for uploads, themes and plugins |
k8s/deployment.yaml | Deployment wordpress: 2 replicas of wordpress:7.1-php8.5-apache on port 80 |
k8s/service.yaml | Service wordpress: port 80 to the pods |
The database password and WordPress's keys and salts are not in any file. You create them as a Secret with kubectl, so they never land in git.
How WordPress fits in Kubernetes
A WordPress server keeps three kinds of state: the WordPress code, the files in wp-content, and the database. On Kubernetes each one gets its own place:
The code comes from the image. The official
wordpressimage copies WordPress into the container when it starts and writeswp-config.phpfromWORDPRESS_*environment variables. Every new pod starts with a clean copy, so you update WordPress by changing the image tag, not from its dashboard.wp-content lives on a shared volume. Uploads, themes and plugins are written at runtime and must survive restarts, so
/var/www/html/wp-contentis a volume. Two replicas write to it at the same time, so it is ReadWriteMany, on thecloider-standard-rwxstorage class. Why a container should never keep files on its own disk is the topic of another post.The database is managed MySQL. No StatefulSet to look after: Cloider runs it, with backups and point-in-time recovery. Pods reach it on its private host, and the connection is encrypted.
Two details matter once there is more than one replica. WordPress signs its login cookies with eight keys and salts, and the image generates random ones in each container when you don't set them: with two replicas, every request that lands on the other pod would log you out. So the Secret sets all eight. And Cloider terminates HTTPS in front of your pods: the image's wp-config.php trusts the X-Forwarded-Proto header, so WordPress knows the request was HTTPS and its links start with https://.
Option 1: the classic way, from the dashboard
Step 1: Create the cluster
Open Kubernetes and click Create Cluster. A name is all it needs, here wordpress:


Step 2: Create the database
Open Databases and click Create Database. Name it wordpress-db with the user wordpress, pick MySQL v9, and add the wordpress cluster to Trusted sources, so only pods in that cluster can connect. Leave SSL Mode on and pick the Hobby plan.

Once it is Ready, its page shows the Connection Details: the username, the password, the database name, the private host and the port. Keep the page open, you need them in the next step. Pods in your Cloider clusters reach the database on its private host, ...db.cloider.internal.

Step 3: Connect kubectl and create the Secret
When the cluster is ready, click it. The cluster page lists your workloads, and has Apply YAML, a Terminal with kubectl, and a button to download the kubeconfig.

Download the kubeconfig from the cluster page, or let the CLI merge it into yours. Then create the wordpress namespace and the Secret with the database credentials and eight random keys and salts. read -rs DB_PASSWORD waits for you to paste the password from the database page without showing it; press Enter after pasting. Replace <private-host>:<port> with the private host and port from the same page:
cloider cluster kubeconfig wordpress --merge --use
kubectl create namespace wordpress
read -rs DB_PASSWORD
kubectl -n wordpress create secret generic wordpress-secrets \
--from-literal=WORDPRESS_DB_HOST=<private-host>:<port> \
--from-literal=WORDPRESS_DB_NAME=wordpress-db \
--from-literal=WORDPRESS_DB_USER=wordpress \
--from-literal=WORDPRESS_DB_PASSWORD="$DB_PASSWORD" \
$(for k in AUTH_KEY SECURE_AUTH_KEY LOGGED_IN_KEY NONCE_KEY \
AUTH_SALT SECURE_AUTH_SALT LOGGED_IN_SALT NONCE_SALT; do
echo "--from-literal=WORDPRESS_$k=$(openssl rand -hex 32)"; done)
Step 4: Apply the Kubernetes manifests
The first file holds two ConfigMaps. wordpress-config adds a few lines to wp-config.php through the image's WORDPRESS_CONFIG_EXTRA variable: the site address, TLS for the database connection, and no automatic core updates, since a core update inside one pod would be gone at its next restart. Replace <subdomain> with the subdomain you will serve the site on. wordpress-php raises PHP's upload limit from 2 MB to 64 MB.
# Settings that aren't secret. The database credentials and WordPress's keys
# and salts live in the Secret wordpress-secrets, created with kubectl.
# Set WP_HOME and WP_SITEURL to the domain you serve the site on.
apiVersion: v1
kind: ConfigMap
metadata:
name: wordpress-config
namespace: wordpress
data:
WORDPRESS_CONFIG_EXTRA: |
define('WP_HOME', 'https://<subdomain>.cloider.app');
define('WP_SITEURL', 'https://<subdomain>.cloider.app');
// Encrypt the connection to the managed MySQL database
define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL);
// WordPress itself comes from the image: update it by changing the image tag
define('WP_AUTO_UPDATE_CORE', false);
---
# PHP accepts uploads up to 64 MB instead of its default 2 MB
apiVersion: v1
kind: ConfigMap
metadata:
name: wordpress-php
namespace: wordpress
data:
uploads.ini: |
upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 256MThe volume for wp-content. ReadWriteMany is what lets both replicas mount it:
# wp-content holds uploads, themes and plugins. ReadWriteMany lets every
# replica mount it at the same time.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: wp-content
namespace: wordpress
spec:
accessModes:
- ReadWriteMany
storageClassName: cloider-standard-rwx
resources:
requests:
storage: 5GiThe Deployment runs two replicas of the official image. It reads its settings from the ConfigMap and the Secret, mounts the volume on wp-content and the PHP settings into PHP's config folder. The readiness probe asks for /wp-login.php, so a pod only gets traffic once PHP answers. The liveness probe only checks the port, so a slow database makes pods unready instead of restarting them.
apiVersion: apps/v1
kind: Deployment
metadata:
name: wordpress
namespace: wordpress
labels:
app: wordpress
spec:
replicas: 2
selector:
matchLabels:
app: wordpress
template:
metadata:
labels:
app: wordpress
spec:
containers:
- name: wordpress
image: wordpress:7.1-php8.5-apache
ports:
- name: http
containerPort: 80
envFrom:
- configMapRef:
name: wordpress-config
- secretRef:
name: wordpress-secrets
volumeMounts:
- name: wp-content
mountPath: /var/www/html/wp-content
- name: php
mountPath: /usr/local/etc/php/conf.d/uploads.ini
subPath: uploads.ini
readinessProbe:
httpGet:
path: /wp-login.php
port: http
periodSeconds: 10
timeoutSeconds: 5
livenessProbe:
tcpSocket:
port: http
initialDelaySeconds: 30
periodSeconds: 10
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: "1"
memory: 512Mi
volumes:
- name: wp-content
persistentVolumeClaim:
claimName: wp-content
- name: php
configMap:
name: wordpress-phpAnd a ClusterIP Service in front of the pods:
apiVersion: v1
kind: Service
metadata:
name: wordpress
namespace: wordpress
spec:
selector:
app: wordpress
ports:
- name: http
port: 80
targetPort: httpApply all four with Apply YAML on the cluster page: paste them one after the other, separated by ---, and click Apply. kubectl apply -f k8s/ does the same from your terminal. In the screenshot the subdomain is filled in.

Within a minute both replicas are running, on different nodes:

The PersistentVolumeClaims view shows the wp-content volume bound, and mounted by both pods:

Step 5: Put it on a free HTTPS subdomain
You don't need an Ingress controller or a load balancer. Open Domains, click Add Domain and choose Subdomain. Type the name you put in the ConfigMap and check that it is free. On the next step, Connect your apps, click Add target, choose Cluster, then the wordpress cluster, namespace and Service, on port 80:

Save the target, then click Add subdomain to claim it:

Cloider serves the subdomain over HTTPS straight away, and its load balancer accepts uploads up to 100 MB.
Step 6: Install WordPress
Open https://<subdomain>.cloider.app. WordPress already has its database, so the installer starts at the language. Finish it right away: until it is done, anyone who opens the address could install the site for themselves.

Give the site a title and create your admin account:


The site is live, served by two replicas over HTTPS:

Option 2: deploy with the cloider CLI
This time every step is in the terminal, and neither the database password nor the keys are ever printed. Install the CLI and log in first: curl -fsSL https://cloider.com/install.sh | sh, then cloider login. Run the commands from the folder that holds k8s/.
Step 1: Create the cluster and the database
Create the cluster, then a MySQL database that only the cluster may reach:
cloider cluster create wordpress-cli --wait
cloider db create wordpress-cli-db --engine mysql --user wordpress --trusted-source cluster:wordpress-cli --wait

Step 2: Connect kubectl and create the Secret
Point kubectl at the cluster and create the namespace:
cloider cluster kubeconfig wordpress-cli --merge --use
kubectl create namespace wordpress
Create the Secret straight from the CLI's output. cloider db get -o json has the private host, port, database name and user, and cloider db password prints the password into the command, not on screen:
DB=$(cloider db get wordpress-cli-db -o json)
kubectl -n wordpress create secret generic wordpress-secrets \
--from-literal=WORDPRESS_DB_HOST="$(jq -r '.private_host + ":" + .database_port' <<<$DB)" \
--from-literal=WORDPRESS_DB_NAME="$(jq -r .database_name <<<$DB)" \
--from-literal=WORDPRESS_DB_USER="$(jq -r .database_user <<<$DB)" \
--from-literal=WORDPRESS_DB_PASSWORD="$(cloider db password wordpress-cli-db)" \
$(for k in AUTH_KEY SECURE_AUTH_KEY LOGGED_IN_KEY NONCE_KEY \
AUTH_SALT SECURE_AUTH_SALT LOGGED_IN_SALT NONCE_SALT; do
echo "--from-literal=WORDPRESS_$k=$(openssl rand -hex 32)"; done)
Step 3: Apply the manifests
Set the subdomain you will claim in step 4, apply the manifests and wait for the rollout. On Linux, write sed -i without the empty quotes:
sed -i '' 's/<subdomain>/your-subdomain/' k8s/config.yaml
kubectl apply -f k8s/
kubectl -n wordpress rollout status deployment/wordpress
Step 4: Expose it on a free HTTPS subdomain
Claim the subdomain and add a target that routes it to the Service:
cloider cluster services wordpress-cli
cloider domain create <subdomain>.cloider.app
cloider target create <subdomain>.cloider.app --cluster wordpress-cli --service wordpress/wordpress
Open https://<subdomain>.cloider.app and install WordPress as in step 6 of option 1.
Option 3: let an AI coding agent deploy it
With the CLI installed and logged in, open a folder in your AI coding agent and ask:
using cloider cli deploy wordpress to cloider kubernetes enginecloider --help points agents to docs.cloider.com/llms.txt, the deployment strategy they follow on Cloider. It tells them to start with cloider whoami, to use a managed database rather than running MySQL in the cluster, and to use Kubernetes when you ask for it, as this prompt does. The commands are the ones in option 2, and the same commands are available as tools through the Cloider MCP server, cloider mcp. See AI coding agents in the docs.
Running it day to day
Update WordPress: change the image tag in
k8s/deployment.yamland apply it. The new pods start with the new version, one at a time. If the release changes the database, WordPress asks you to update it the next time you open/wp-admin. Plugins and themes update from the WordPress dashboard as usual, since they live on the shared volume.Change a setting: pods read the ConfigMaps and the Secret when they start, so after changing one, run
kubectl -n wordpress rollout restart deployment/wordpress.Scale:
kubectl -n wordpress scale deployment/wordpress --replicas=3. Every replica mounts the same volume. Each busy PHP worker holds a database connection, and the Hobby plan allows 20, so pick a bigger plan before you add many replicas.Use your own domain from the start: WordPress writes the site address into posts and settings, so moving to another domain later means updating those too. Add the domain under Domains with a target to the same Service, and put it in
WP_HOMEandWP_SITEURL.Back up: the managed database keeps point-in-time recovery for 14 days, so you can restore any second of that window into a new database. For
wp-content, copy it out withkubectl -n wordpress exec deploy/wordpress -- tar czf - -C /var/www/html wp-content > wp-content.tgz, or keep your media in object storage with an S3 offload plugin. Which belongs where is covered in persistent volumes vs object storage.
Troubleshooting
Error establishing a database connection: the host, port or password in
wordpress-secretsis wrong, or the cluster isn't in the database's trusted sources. Fix the Secret (kubectl -n wordpress delete secret wordpress-secrets, create it again) and restart the Deployment.Pods stay Pending: the
wp-contentclaim isn't bound. Checkkubectl -n wordpress get pvc: it needs thecloider-standard-rwxstorage class for ReadWriteMany.Logged out at random: the keys and salts differ between replicas. Set all eight in the Secret, as in step 3.
Links or styles point to the wrong address:
WP_HOMEandWP_SITEURLink8s/config.yamldon't match the domain. Fix them, apply, and restart the Deployment.The uploaded file exceeds the upload_max_filesize directive: the
wordpress-phpConfigMap isn't mounted, or the file is over 64 MB. Raise both values inuploads.iniup to 100 MB, the most Cloider's load balancer accepts.Too many connections: more PHP workers than the database plan allows connections. Use fewer replicas or a bigger plan.
What it costs
A cluster is billed for the CPU and memory its workloads use, and volumes at $0.50 per GiB a month, so the 5 GiB wp-content volume is $2.50 a month. The Hobby MySQL plan is $3.99 a month. Everything is charged by the hour, and targets on a free subdomain cost nothing extra. A new account's welcome credit covers this guide. Delete the cluster, the database and the subdomain when you're done.
Frequently asked questions
Can WordPress run with more than one replica on Kubernetes?
Yes, when wp-content is on ReadWriteMany storage that every replica mounts and the eight keys and salts are the same in every pod. Set them in a Secret: the official image otherwise generates random ones per container, and users get logged out whenever a request reaches another replica.
Should I run MySQL inside the Kubernetes cluster for WordPress?
A managed database is simpler: Cloider runs MySQL with backups and 14 days of point-in-time recovery, and pods reach it on its private host over TLS. Add the cluster as the database's trusted source so nothing else can connect.
How do I update WordPress on Kubernetes?
Change the image tag in the Deployment and apply it. Each new pod starts with the new version, and WordPress asks to update the database in /wp-admin if the release needs it. Turn off automatic core updates (WP_AUTO_UPDATE_CORE false), since an update inside a pod is lost when it restarts.
Do I need an Ingress controller for WordPress on Cloider Kubernetes?
No. Claim a free cloider.app subdomain or add your own domain, and add a target that routes it to the wordpress Service. Cloider terminates HTTPS, and the official image trusts the X-Forwarded-Proto header, so WordPress generates https links.
How large can WordPress uploads be on Cloider?
This guide sets PHP's upload_max_filesize and post_max_size to 64 MB in a ConfigMap. Cloider's load balancer accepts request bodies up to 100 MB.



Comments