KubeKanvas Logo
FeaturesPricingTemplatesBlogFAQsContact
FeaturesPricingTemplatesBlogFAQsContact

High Available WordPress deployment in Kubernetes

High Available WordPress deployment in Kubernetes

Shamaila Mahmood

Shamaila Mahmood

May 26, 2025

Technology
Deploy Wordpress in Kubernetes

Deploying WordPress on Kubernetes (Without Losing Your Sanity)

WordPress and Kubernetes — sounds like an odd couple at first, doesn’t it?

One’s a legendary blogging platform with a love for PHP and plugins. The other is a cloud-native orchestrator that schedules containers like a micromanaging boss. But together, they can give you a scalable, self-healing website that runs like a dream… once you get past the YAML.

In this guide, we’ll walk through deploying WordPress on Kubernetes using hostPath volumes — the “keep it simple, we’re just testing” approach. If you’re looking for a highly available, production-ready, replicated, auto-scaling beast… this ain’t it. But if you want to get started without waking up in cold sweats, read on.


What You’ll Need

  • A running Kubernetes cluster (Minikube works great for this)
  • kubectl access
  • The ability to copy-paste YAML or use kubekanvas.io
  • 10 minutes and a bit of faith

Step 1: Deploy MySQL

WordPress needs a database. We’ll use MySQL and keep its data in a hostPath so it sticks around (kind of like that one friend who never leaves your couch).

Here’s a simple YAML:

apiVersion: v1
kind: Pod
metadata:
  name: mysql
  labels:
    app: mysql
spec:
  containers:
    - name: mysql
      image: mysql:5.7
      env:
        - name: MYSQL_ROOT_PASSWORD
          value: password
        - name: MYSQL_DATABASE
          value: wordpress
      ports:
        - containerPort: 3306
      volumeMounts:
        - mountPath: /var/lib/mysql
          name: mysql-storage
  volumes:
    - name: mysql-storage
      hostPath:
        path: /data/mysql
        type: DirectoryOrCreate
---
apiVersion: v1
kind: Service
metadata:
  name: mysql
spec:
  selector:
    app: mysql
  ports:
    - port: 3306

🧠 Heads up: This is great for demos, but don’t use hostPath in production unless you like living dangerously.


Step 2: Deploy WordPress

Now the fun part — launching WordPress itself. We’ll give it a PVC… just kidding, it’s another hostPath.

apiVersion: v1
kind: Pod
metadata:
  name: wordpress
  labels:
    app: wordpress
spec:
  containers:
    - name: wordpress
      image: wordpress:latest
      env:
        - name: WORDPRESS_DB_HOST
          value: mysql:3306
        - name: WORDPRESS_DB_PASSWORD
          value: password
      ports:
        - containerPort: 80
      volumeMounts:
        - mountPath: /var/www/html
          name: wp-content
  volumes:
    - name: wp-content
      hostPath:
        path: /data/wordpress
        type: DirectoryOrCreate
---
apiVersion: v1
kind: Service
metadata:
  name: wordpress
spec:
  type: NodePort
  selector:
    app: wordpress
  ports:
    - port: 80
      nodePort: 30080

With this, WordPress will be available at http://<your-node-ip>:30080. That’s your cue to open a browser and start picking a theme.

testing

Don’t like writing YAML by hand?

We already have a template for you to get started in seconds. Use this template to start with a basic deployment of WordPress — no stress, just drag and drop.

Load More

Step 3: Access WordPress

Once both Pods are running, get your Node IP:

kubectl get nodes -o wide

Then visit: http://<Node-IP>:30080

You should see the WordPress setup screen. Fill in the details and boom — you’re in!


A Few Words of Wisdom

  • Use hostPath only for local demos. It ties your workload to the node like a clingy ex. If the Pod moves, your data doesn’t.
  • No Ingress here — just good old NodePort. You can spice it up later with Traefik or NGINX.
  • Security? Not today. But we can talk about that once you’re done playing around.

Conclusion

Deploying WordPress on Kubernetes doesn’t have to feel like deciphering ancient scrolls. With a few carefully chosen YAMLs and some light humor, you can get a working blog or demo site up and running in no time.

Next step? Try doing this visually with Kubekanvas. It’s faster, cleaner, and it makes you feel like a Kubernetes artist.

KubeKanvas Logo

Visual Kubernetes cluster design tool that helps you create, manage, and deploy your applications with ease.

Product

  • Features
  • Pricing
  • Templates

Resources

  • Blog
  • Tutorials

Company

  • About Us
  • Contact
  • Terms of Service
  • Privacy Policy
TwitterGitHubLinkedIn
© 2025 KubeKanvas. All rights reserved.