MariaDB & K8s: Deploy MariaDB and WordPress using Persistent Volumes

In the previous blog, MariaDB & K8s: Create a Secret and use it in MariaDB deployment, we used the Secrets resource to hide confidential root user data, and in the blog before that in the series, MariaDB & K8s: Communication between containers/Deployments, we created 2 containers (namely MariaDB and phpmyadmin) in a Pod. That kind of deployment didn’t have any persistent volumes.

In this blog we are going to create separate Deployments for MariaDB and WordPress applications as well as a Service for both in order to connect them. Additionally we will create Volume in a Pods of a MariaDB Deployment.

MariaDB & K8s: Create a Secret and use it in MariaDB deployment

In the previous blog we created a stateless application, deployed it with K8s resource Deployment, and exposed the root password, which, regarding security, is of course not recommended. K8s allows one to hide confidential data using specific K8s resources.

Let’s see how to use Secrets in K8s.

Secrets in K8s

In order to save confidential data one can use a K8s resource called Secret.

One can create Secret from the CLI by running kubectl create secret.

Here we will use two methods to create the secret.

MariaDB & K8s: Communication between containers/Deployments

In the previous blog, a background Deployment resource was created from a YAML file, consisting of a single container (MariaDB) that acts as a background container.

In this blog we are going to proceed to create the frontend container to communicate with the backend through a Service and other resources.

About Services

When an application is run through the Deployment Pods are created and destroyed dynamically. When created, they get the internal IP address in a cluster, and since they are ephemeral, there needs to be a stable way to allow communications between Pods.

Start MariaDB in K8s

This is the first in a series of blogs explaining how to use MariaDB in Kubernetes (K8s), as well as explaining some important concepts of K8s and of MariaDB.

This blog explains how to start MariaDB as a stateless application in K8s using the CLI and explores different commands you can run on your CLI.

The prerequisites are that you have installed kubectl (which will also install Docker runtime) and minikube (local K8s).

Let’s first start the minikube

$ minikube start && kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready control-plane,master 104d v1.22.2

The Pod is a K8s resource and the smallest unit in K8s.

New Sponsor: Schaffhausen Institute of Technology

Good news from and for MariaDB Foundation: in Schaffhausen Institute of Technology (SIT), we have a new Platinum Sponsor. With the additional funds and with the insights provided by Serguei Beloussov, who will work with the MariaDB Foundation on the board level, we expect to improve our ability to further the MariaDB Foundation mission related to our values of Openness, Adoption, and Continuity.

Introducing SIT

This event marks a first in our work with sponsors, given that our top-level sponsor list has so far contained only names fairly familiar to industry players: DBS Bank, Visma, IBM, Microsoft, Alibaba, Tencent, and Service Now, not to mention the eponymous MariaDB Corporation.

We stand with Ukraine

This is a difficult blog entry to write. It involves war. But not a flame war. A real war where people are dying. Innocent people. You have all seen the pictures and videos, it is not my task to describe that.

MariaDB Foundation has been slow to react. This is because we have strong ties to both Ukrainian and Russian developers and we want to do the right thing, as individuals and as the Foundation. Let it be perfectly clear that MariaDB Foundation stands with Ukraine; that said, the rest of the blog is not written in first person plural.

New Service – quay.io/mariadb-foundation/mariadb-devel

During the development of MariaDB, a lot of things are tested. However the most important workload to be tested is the one we don’t have access to, and that is your workload.

As many of you run your own CI, we’d like you to invite you to join the testing of MariaDB. quay.io/mariadb-foundation/mariadb-devel is a container repository using the latest from our main stable branches. By the time any code gets into these branches it has been reviewed and passed our tests. The developers of the change consider it finished, so this is the perfect time to take this code and test it on your workload.

Docker Library – Official MariaDB Image Maintenance

The Docker Library official MariaDB image is now maintained by the MariaDB Foundation, and has been for the last six months. If you didn’t notice, we’ll take that as a compliment, as the previous maintainers of Docker Library from Infosiftr were doing a good job already. Infosiftr still provide valuable quality assurance on the releases before they get to you.

What’s Changed?

What we have done, with assistance from you, our community, is:

Timezones

  • Continued the parting contribution by Infosiftr MARIADB_* environment names and added MARIADB_INITDB_SKIP_TZINFO for consistency.
  • Allowed the timezone to be changed.