Deploying WordPress with Kubernetes Resource Orchestrator (Kro) on Minikube
This guide explains how to use the Kubernetes Resource Orchestrator (Kro) to define a reusable Resource Graph Definition for WordPress, install Minikube and Kro, and deploy multiple WordPress instances on a local Kubernetes cluster.
In cloud‑native environments, Kubernetes orchestrates workloads, but scaling and managing complex resources can be challenging; Kubernetes Resource Orchestrator (Kro) simplifies this by allowing developers to define a Resource Graph Definition (RGD) that encapsulates all required objects.
Kro Application Scenarios
For a hosted‑service provider offering customized WordPress sites, Kro enables a centralized blueprint that standardizes core settings (database, storage, ingress) while allowing per‑customer customizations such as credentials and domains, improving scalability, reliability, and maintenance efficiency.
Practice: Deploy WordPress with Kro
Step 1: Install and Configure Minikube
Install Minikube, start it with ingress enabled, and configure local storage:
curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube-darwin-arm64
sudo install minikube-darwin-arm64 /usr/local/bin/minikube
minikube start
minikube addons enable ingress
kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.31/deploy/local-path-storage.yaml
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bashStep 2: Install Kro on Minikube
Fetch the latest Kro version and install it via Helm:
export KRO_VERSION=$(curl -sL https://api.github.com/repos/kro-run/kro/releases/latest | jq -r '.tag_name | ltrimstr("v")')
helm install kro oci://ghcr.io/kro-run/kro/kro --namespace kro --create-namespace --version=${KRO_VERSION}This creates the Kro custom resource definition (CRD) in the cluster.
Step 3: Deploy WordPress Using Kro
Create a Resource Graph Definition file wordpress-rgd.yaml that describes all Kubernetes objects needed for WordPress, including a MySQL secret, PVC, MySQL deployment and service, and the WordPress deployment and service.
apiVersion: kro.run/v1alpha1
kind: ResourceGraphDefinition
metadata:
name: wordpress
spec:
resources:
- apiVersion: v1
kind: Secret
metadata:
name: mysql-pass
stringData:
password: "password"
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
- apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql
spec:
selector:
matchLabels:
app: mysql
strategy:
type: Recreate
template:
metadata:
labels:
app: mysql
spec:
containers:
- image: mysql:5.7
name: mysql
env:
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-pass
key: password
ports:
- containerPort: 3306
volumeMounts:
- name: mysql-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-storage
persistentVolumeClaim:
claimName: mysql-pvc
- apiVersion: v1
kind: Service
metadata:
name: mysql
spec:
ports:
- port: 3306
selector:
app: mysql
clusterIP: None
- apiVersion: apps/v1
kind: Deployment
metadata:
name: wordpress
spec:
selector:
matchLabels:
app: wordpress
replicas: 2
template:
metadata:
labels:
app: wordpress
spec:
containers:
- image: wordpress:5.8.3-php8.0
name: wordpress
env:
- name: WORDPRESS_DB_HOST
value: "mysql:3306"
- name: WORDPRESS_DB_USER
value: "root"
- name: WORDPRESS_DB_PASSWORD
valueFrom:
secretKeyRef:
name: mysql-pass
key: password
ports:
- containerPort: 80
volumeMounts:
- name: wordpress-storage
mountPath: /var/www/html
volumes:
- name: wordpress-storage
persistentVolumeClaim:
claimName: mysql-pvc
- apiVersion: v1
kind: Service
metadata:
name: wordpress
spec:
type: NodePort
ports:
- port: 80
nodePort: 30080
selector:
app: wordpressApply the RGD and create two instances with different parameters:
kubectl apply -f wordpress-rgd.yaml
kubectl apply -f - <These commands deploy two independent WordPress sites using the same reusable blueprint, demonstrating how Kro abstracts complex Kubernetes resource orchestration into a maintainable, repeatable workflow.
Conclusion
Kro is a powerful tool for managing complex workloads on Kubernetes; by defining an RGD, developers can turn intricate resource graphs into reusable blueprints, streamlining deployment, reducing errors, and improving operational efficiency for both web applications like WordPress and larger enterprise services.
Cloud Native Technology Community
The Cloud Native Technology Community, part of the CNBPA Cloud Native Technology Practice Alliance, focuses on evangelizing cutting‑edge cloud‑native technologies and practical implementations. It shares in‑depth content, case studies, and event/meetup information on containers, Kubernetes, DevOps, Service Mesh, and other cloud‑native tech, along with updates from the CNBPA alliance.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.