Last active
April 6, 2025 07:22
-
-
Save geerlingguy/e6a661e1cd2b53f6a39493ebb207425c to your computer and use it in GitHub Desktop.
Wordpress in Kubernetes K3s on Raspberry Pi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This manifest assumes 'wordpress' namespace is already present: | |
# | |
# kubectl create namespace wordpress | |
# | |
# Apply the manifest with: | |
# | |
# kubectl apply -f mariadb.yml | |
--- | |
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: mariadb-pass | |
namespace: wordpress | |
labels: | |
app: wordpress | |
data: | |
# This value is base64-encoded. Do not use this password in production! | |
password: MjJzaXl3dVpBNFdmeHNZcg== | |
--- | |
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
name: mariadb-pv-claim | |
namespace: wordpress | |
labels: | |
app: wordpress | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 1Gi | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: wordpress-mariadb | |
namespace: wordpress | |
labels: | |
app: wordpress | |
spec: | |
selector: | |
matchLabels: | |
app: wordpress | |
tier: mariadb | |
strategy: | |
type: Recreate | |
template: | |
metadata: | |
labels: | |
app: wordpress | |
tier: mariadb | |
spec: | |
containers: | |
- image: tobi312/rpi-mariadb:10.3 | |
name: mariadb | |
env: | |
- name: MYSQL_ROOT_PASSWORD | |
valueFrom: | |
secretKeyRef: | |
name: mariadb-pass | |
key: password | |
ports: | |
- containerPort: 3306 | |
name: mariadb | |
volumeMounts: | |
- name: mariadb-persistent-storage | |
mountPath: /var/lib/mysql | |
resources: | |
limits: | |
cpu: '1' | |
memory: '512Mi' | |
requests: | |
cpu: '500m' | |
memory: '256Mi' | |
volumes: | |
- name: mariadb-persistent-storage | |
persistentVolumeClaim: | |
claimName: mariadb-pv-claim | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: wordpress-mariadb | |
namespace: wordpress | |
labels: | |
app: wordpress | |
spec: | |
ports: | |
- port: 3306 | |
selector: | |
app: wordpress | |
tier: mariadb | |
clusterIP: None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This manifest assumes 'wordpress' namespace is already present: | |
# | |
# kubectl create namespace wordpress | |
# | |
# Apply the manifest with: | |
# | |
# kubectl apply -f wordpress.yml | |
--- | |
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
name: wp-pv-claim | |
namespace: wordpress | |
labels: | |
app: wordpress | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 1Gi | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: wordpress | |
namespace: wordpress | |
labels: | |
app: wordpress | |
spec: | |
selector: | |
matchLabels: | |
app: wordpress | |
tier: frontend | |
strategy: | |
type: Recreate | |
template: | |
metadata: | |
labels: | |
app: wordpress | |
tier: frontend | |
spec: | |
containers: | |
- image: wordpress:5.4-apache | |
name: wordpress | |
env: | |
- name: WORDPRESS_DB_HOST | |
value: wordpress-mariadb | |
- name: WORDPRESS_DB_PASSWORD | |
valueFrom: | |
secretKeyRef: | |
name: mariadb-pass | |
key: password | |
ports: | |
- containerPort: 80 | |
name: wordpress | |
volumeMounts: | |
- name: wordpress-persistent-storage | |
mountPath: /var/www/html | |
resources: | |
limits: | |
cpu: '1' | |
memory: '512Mi' | |
requests: | |
cpu: '500m' | |
memory: '256Mi' | |
volumes: | |
- name: wordpress-persistent-storage | |
persistentVolumeClaim: | |
claimName: wp-pv-claim | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: wordpress | |
namespace: wordpress | |
labels: | |
app: wordpress | |
spec: | |
ports: | |
- port: 80 | |
selector: | |
app: wordpress | |
tier: frontend | |
type: NodePort | |
--- | |
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: wordpress | |
namespace: wordpress | |
spec: | |
rules: | |
- host: wordpress.10.0.100.99.nip.io | |
http: | |
paths: | |
- path: / | |
backend: | |
serviceName: wordpress | |
servicePort: 80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i have this error and im not able to access the setup page im new to this and need help
error: resource mapping not found for name: "wordpress" namespace: "wordpress" from "matt-blog/wordpress.yml": no matches for kind "Ingress" in version "extensions/v1beta1"
ensure CRDs are installed first