Key Features • How To Use • Installation • Build and Development • License
Made with ❤️ by Hostzero
Need help with your DevOps or Kubernetes setup? Contact us at Hostzero for professional support and services!
Deploying a WordPress instance with KubePress involves two steps:
For more detailed instructions, please refer to the User Guide.
Create the secret in the same namespace where you want to deploy the WordPress instance.
kubectl apply -f - <<EOF
apiVersion: v1
kind: Secret
metadata:
name: wp--w1-com
namespace: kubepress
type: Opaque
data:
username: YWRtaW4= # admin
password: cGFzc3dvcmQK # password
EOF
After that, you can create the WordPress Custom Resource as shown below.
kubectl apply -f - <<EOF
apiVersion: crm.hostzero.de/v1
kind: WordPressSite
metadata:
name: wp--w1-com
namespace: kubepress
spec:
siteTitle: w1
adminEmail: admin@example.com
adminUserSecretKeyRef: wp--w1-com
database:
createNew: true
wordpress:
image: wordpress:latest
maxUploadLimit: 64M
replicas: 1
resources:
cpuLimit: 500m
cpuRequest: 250m
memoryLimit: 1Gi
memoryRequest: 512Mi
storageSize: 10Gi
ingress:
host: w1.com
tls: false
EOF
After a few seconds, the operator will create all the necessary resources for your WordPress instance. After that the website should be accessible:
curl -I w1.com/wp-login.php
Installation of KubePress is done using a Helm chart. The chart is located in the dist/chart directory and is generated by the kubebuilder toolchain.
helm repo add mariadb-operator https://helm.mariadb.com/mariadb-operator
helm install mariadb-operator-crds mariadb-operator/mariadb-operator-crds
helm install mariadb-operator \
-n mariadb-operator --create-namespace \
mariadb-operator/mariadb-operator
Please refer to the official MariaDB Operator Docs for detailed instructions.
Helm must be installed to use the charts. Please refer to Helm’s documentation to get started.
Once Helm has been set up correctly, add the repo as follows:
helm repo add kubepress https://hostzero-gmbh.github.io/KubePress/
Before installing the operator make sure that all the config values are correct.
Especially make sure that all the values under the key controllerManager.env in dist/chart/values.yaml are set correctly. What these values do is explained in the comments in the values.yaml file.
To install the KubePress Helm chart, you can use the following command:
helm upgrade --install my-kubepress kubepress/kubepress --namespace kubepress-controller -f dist/chart/values.yaml
Before trying the real thing, you can test the Helm chart with a dry-run to see if everything is set up correctly.
helm upgrade --install kubepress dist/chart/ --namespace kubepress-controller -f dist/chart/values.yaml --dry-run
To delete the Helm release, you can use the following command:
helm uninstall kubepress --namespace kubepress-controller
The KubePress operator is built using the Operator SDK, which simplifies the development of Kubernetes operators. To understand the codebase, familiarize yourself with the following directories:
api/v1: Custom resource definitions (CRDs) for WordPress and MySQL resources. make generate will update the zz_generated.deepcopy file to reflect changes in the CRDs.cmd/: Main entry point for the operator.config/: The config directory contains all the Kubernetes manifests and configuration files needed to deploy and manage the KubePress operator.dist/chart: Helm chart for deploying KubePress. Generated by the kubebuilder toolchain. Some modifications were made to the generated chart to fit our needs.internal/controller/wordpress: Core logic of the operator containing the logic for managing WordPress instances.To build the KubePress operator, follow these steps:
docker build -t kubepress-dev:0.1.17 .
make generate
0.1.17 in chart/Chart.yaml.For testing TLS, deploy a self-signed issuer:
kubectl apply -f - <<EOF
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: selfsigned-cluster-issuer
spec:
selfSigned: {}
EOF
To generate the Helm chart, you can use the following command:
# Enable or Update the helm chart via the helm plugin to an existing project
# Before run the edit command, run `make manifests` to generate the manifest under `config/`
make manifests
kubebuilder edit --plugins=helm/v1-alpha
This is documented in the Kubebuilder documentation.
This project is licensed under the MIT License. See the LICENSE file for details.