Add custom init containers

If you want to run migrations or perform other operations that are required before your site starts, you'll want to do it in an init container, so here are the steps to add one.

If you don't know what an init container is, read more about them on the Kubernetes docs .


This how-to assumes that you know how to connect to your Google Cloud cluster and have kubectl installed.

1. Edit the site's Wordpress Kubernetes resource

To add an init container, you will currently need to edit the Wordpress Kubernetes resource that represents your site. Its details can be found in the Runtime section , under the Kubernetes Project Namespace and Kubernetes Site Name site fields.

For this example, let's assume the project namespace is proj-jqojzq and the site name is my-site-com-h9wgm. Run the following command:

kubectl edit wordpress -n proj-jqojzq my-site-com-h9wgm

2. Add init containers

The resource hopefully opened in your text editor. There you will be able to add your init containers in the .spec.initContainers section (if it is missing you may safely add it).

3. Update the sync-init-containers annotation

In order to use the same image and environment variables as the Wordpress container of your site, you will have to add an annotation that contains the names of your init containers. For this example, let's assume you've added two init containers, named migrations-init and cleanup-init. The annotation you'll then add to .metadata.annotations would be: "migrations-init, cleanup-init"

The Dashboard will then sync the image and environment variable fields of the specified init containers with the ones of the Wordpress container, everytime they change.

See Also

Add a preemptible node

To reduce the costs, you can run PHP pods on cheaper nodes.

Configure ProxySQL

Sometimes you will need to set custom variables in ProxySQL configuration or you will want to cache [...]

Increase the default limit range resources

Presslabs Dashboard has default limit ranges for memory and CPU, which you can modify to accommodate [...]

Invite a user to your organization

You can invite users to your organization, which will give them access to all the projects and sites [...]