Taxonomy Icon

Containers

Deploy a scalable WordPress implementation on Kubernetes

Get the code

Summary

WordPress is the world’s most popular website management and blogging system, supporting more than 60 million websites. At its core, WordPress is built on one of the most common web programming languages, PHP, and uses MySQL as its back-end database. Kubernetes, the open source container management system, is one of the top 10 GitHub projects based on the number of unique developers contributing code. The challenge for developers is how to bring these two giant open source projects together to provide maximum benefits.

Description

You as a developer are looking to create best-of-class applications, and to do that you need to use the leading tools and platforms. This pattern shows you how to harness the full power of Kubernetes clusters and demonstrates how easy it is to deploy the world’s most popular website framework on top of world’s most popular container orchestration platform.

You’ll find step-by-step instructions, including a full roadmap for hosting WordPress on a Kubernetes Cluster from the IBM Cloud Kubernetes Service. Each component runs in a separate container or group of containers.

WordPress represents a typical multi-tier app and each component will have its own containers. The WordPress containers are the front-end tier and the MySQL container is the database/back-end tier for WordPress. The WordPress front-end tier can use MySQL as a service from IBM Cloud.

Flow

flow

  1. The user interacts with WordPress via the web interface. Each WordPress container will respond to its users via HTTP/HTTPS.
  2. When a user posts to any WordPress container, WordPress will typically post the changes to the MySQL database. The MySQL database stores the post data into persistent disks to maintain security. In addition to a MySQL container, you can also use the Compose MySQL service from IBM Cloud. After authentication and authorization are complete, WordPress user information such as a password (encrypted with MD5) and email address is created and stored in MySQL. The website, blogs, tags, categories, and other data are also stored in MySQL.
  3. The user can also upload themes, plugins, images, and documents. Non-textual data such as PDFs, videos, and MP3s, can also be uploaded.
  4. Themes, plugins, PDFs, videos, MP3s, etc. are stored in a persistent volume attached to the WordPress pods.
  5. The user accesses the WordPress website or blog. The WordPress core (that is, the WordPress “brain”) calls the required PHP scripts, starting with index.php.
  6. WordPress reaches out to the MySQL database to retrieve the website, blogs, tags, categories, and so on.
  7. The WordPress core then retrieves the themes, documents, images, etc. from the persistent volume, combines it with data retrieved from the database, and presents the page to the user.

Instructions

Ready to put this code pattern to use? Complete details on how to get started running and using this application are in the README.