Skip to content
Snippets Groups Projects
README.md 10.23 KiB

Setup

Prerequisites

  1. Make sure you have kubernetes-cli and helm (version >= 3) installed on your development machine

  2. Make sure you have a running kubernetes cluster that your kubectl is connected to. Check this by running kubectl version. It should tell you the client and server version of Kubernetes.

  3. The redis and MariaDB helm charts live in a custom Bitnami chart repository (the ones in the helm stable repository are deprecated and moved there). Get the repository by running:

    $ helm repo add bitnami https://charts.bitnami.com/bitnami
  4. The chart assumes you have nginx ingress running in IP range 10.0.0.0/8. If you do, the access logs will show remote IP addresses from the X-Forwarded-For header. Otherwise, the proxy IP address is shown in the access logs.

    If you don't use nginx ingress and you enable mu_cron, make sure to block the path from wordpress.mu_cron.cronjob.path from outside traffic.

Start WordPress on Kubernetes

Configuration

Copy values-local.yaml.example to values-local.yaml. This file contains a lot of variables that you can change to adjust the WordPress installation to your needs.

For a simple WordPress installation, you only need to edit the following values:

Parameter Description Default
ansibleVars.WP_URL The URL of your WordPress website http://localhost
ansibleVars.WP_TITLE The title of the site Demo WP
ansibleVars.WP_THEME_ACTIVE A slug for the theme you want to install on your site (can also be changed through interface) twentytwenty
ansibleVars.WP_EMAIL The administrator's email adress youremailhere@example.com
database.auth.username Database user wordpress
database.auth.password wordpress db user password You really need to set this
database.auth.rootPassword root user password You really need to set this
database.auth.replicationPassword replication user password You really need to set this

You can read the descriptions of the other variables in values-local.yaml.example and of even more variables in values.yaml.

Note about theme fallback

If there is no theme available to activate in wp_content then the fallback theme will be used This is set by wordpress.site.theme_fallback from values.yaml

Note about the ansibleVars:

All the variables under ansibleVars are used by the ansible playbook that is run in the init container to configure the WordPress website. You can find their default values in the values.yaml file. You can override single values of ansibleVars.<any variable> in your values-local.yaml file. NOTE: if you would want to override variables in ansibleSecrets, you have to copy the whole ansibleSecrets string to values-local.yaml!

Installation

  1. Install the helm dependencies by typing helm dep update

  2. Start WordPress by typing running install.sh.

    NOTE: if you override the image or initImage tags in values.yaml, installation with this script ignores that.

See What happens when I install this? for information on what happens now.

Removal

To undo an installation and remove all traces of it ever existing, use the delete.sh script. NOTE: use this at your own risk! Your databases, uploads, etc. will be removed for ever!

Troubleshooting

To debug the init container, you can use kubectl logs, but because it is not the default container, you need to use the -c argument as follows: