Install Wordpress in k8s with Bitnami helm
Estimated time to read: 6 minutes
How to install Wordpress in Enterprise Managed Kubernetes with the use of Bitnami helm charts.
In this tutorial we will walk through setting up an Wordpress instance in Kubernetes by the help of Bitnami helm charts. The tutorial will contain:
- Setting up access to your cluster
- Finding and using the correct helm charts
- Exploring the resources the helm chart has deployed
- Access your Wordpress installation
Prerequisites
For management you need some software:
Create a new directory where you put everything for this deployment. This contains the configuration files for access to your EMK cluster and the services you roll out. for example ~/EMK-demo (we will continue to use this).
Then go to https://my.fuga.cloud/managed-kubernetes and deploy an EMK cluster.
(If you are new with this, you can always check our "let's get started with EMK" tutorials)
Setting up access to your cluster
To use EMK, or K8S you need a kubeconfig. You can find these at the Fuga dashboard at the right menu, as EMK, or go straight to https://my.fuga.cloud/managed-kubernetes
Click the hamburger menu next to your cluster and choose 'Cluster Access'.
Download the Kubeconfig to ~/EMK-demo/kubeconfig and adjust the permissions, for example:
By default this data is read by kubectl from ~/.kube/config but in this case, we put it somewhere else. To make sure that kubeconfig finds this file, we set the following variable, which tells kubectl to search the current path to the kubeconfig file.Test this with kubectl get nodes
kubectl get nodes
NAME STATUS ROLES AGE VERSION
shoot--oswl827--demo-worker-demo-1-z1-7bc7d-hnjkm Ready <none> 8m57s v1.24.6
shoot--oswl827--demo-worker-demo-1-z2-5f96c-jvk46 Ready <none> 8m52s v1.24.6
Finding and using the correct helm charts
Now we have access to our cluster we have to setup the helm charts and deploy them to the cluster.
Bitnami is a party that offers ready-made solutions for a number of standard hosting software solutions. They also offer k8s configurations.
To make use of the charts they provide, you have to add the Bitnami catalog as follows:
Helm is a tool to define, install and upgrade applications that use Kubernetes. Basically Helm is a templating engine that generates and updates Kubernetes manifests from templates.
To start we have to update the current repo first with:
You can see the available helm repositories with: To check available software, you use In this tutorial we are going to install wordpress, so find the wordpress chart repo with the search function: To get more information about the chart, we can check it out with: and if you want to show everything (that's a lot)Installing the Wordpress chart:
We have found the chart and can now install it, to install it you can use the following command:
helm install bitnami/wordpress --generate-name
NAME: wordpress-1666174896
LAST DEPLOYED: Wed Oct 19 12:21:38 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: wordpress
CHART VERSION: 15.2.5
APP VERSION: 6.0.2
** Please be patient while the chart is being deployed **
Your WordPress site can be accessed through the following DNS name from within your cluster:
wordpress-1666174896.default.svc.cluster.local (port 80)
To access your WordPress site from outside the cluster follow the steps below:
1. Get the WordPress URL by running these commands:
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
Watch the status with: 'kubectl get svc --namespace default -w wordpress-1666174896'
export SERVICE_IP=$(kubectl get svc --namespace default wordpress-1666174896 --include "")
echo "WordPress URL: http://$SERVICE_IP/"
echo "WordPress Admin URL: http://$SERVICE_IP/admin"
2. Open a browser and access WordPress using the obtained URL.
3. Login with the following credentials below to see your blog:
echo Username: user
echo Password: $(kubectl get secret --namespace default wordpress-1666174896 -o jsonpath="{.data.wordpress-password}" | base64 -d)
kubectl get svc --namespace default -w wordpress-1666174896
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
wordpress-1666174896 LoadBalancer 100.64.33.69 <pending> 80:30267/TCP,443:31728/TCP 77s
wordpress-1666174896 LoadBalancer 100.64.33.69 <pending> 80:30267/TCP,443:31728/TCP 2m52s
wordpress-1666174896 LoadBalancer 100.64.33.69 81.24.10.208 80:30267/TCP,443:31728/TCP 2m52s
Exploring the resources the helm chart has deployed
To understand a bit better what we have done with the installation of the helm chart we are going to dive a bit deeper in what it actually has deployed.
It's possible to also understand this from the helm charts, but we have already deployed it. So we are going to checkout some resources.
Namespaces
In Kubernetes resources are deployed in something called namespaces, it is a kind of grouping of services, you can see these by using:
Services
Your services will be within a namespace, using the default namespace as a standard:
Pods
The services from above launches pods where the actual service is running in. So this is where the Wordpress pod is running.
Persistent Volumes (PVC)
To safely store your data, Kubernetes can use Persistent Volumes also called PVC in short. Those are not on your worker nodes, but attached and stored outside of your cluster in a storage array. This will make sure that if a worker node is removed the data still exists in the PVC. To get a list of all the created PVC's use:
Deployments
You can find the deployment from the helm chart with:
Replicaset
Secrets
As stated while deploying Wordpress, it would be possible for us to find the Wordpress password in a Secret. To view all the created secrets:
kubectl get secrets
NAME TYPE DATA AGE
sh.helm.release.v1.wordpress-1666174896.v1 helm.sh/release.v1 1 4h45m
wordpress-1666174896 Opaque 1 4h45m
wordpress-1666174896-mariadb Opaque 2 4h45m
kubectl get secret wordpress-1666174896 -o yaml
apiVersion: v1
data:
wordpress-password: WU9xMDhRM0J0ag==
kind: Secret
metadata:
annotations:
meta.helm.sh/release-name: wordpress-1666174896
meta.helm.sh/release-namespace: default
creationTimestamp: "2022-10-01T10:21:39Z"
labels:
app.kubernetes.io/instance: wordpress-1666174896
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: wordpress
helm.sh/chart: wordpress-15.2.5
name: wordpress-1666174896
namespace: default
resourceVersion: "5436"
uid: 5656c234-c2d6-4c22-a7db-514404334a60
type: Opaque
Access your Wordpress installation
Get the IP address of your cluster with the following command from the service:
export SERVICE_IP=$(kubectl get svc --namespace default wordpress-<your_number> --include "")
echo "WordPress URL: http://$SERVICE_IP/"
To login use as user: "user" and the password you have retrieved from the Wordpress secret.