Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- apiVersion: v1
- kind: PersistentVolume
- metadata:
- name: wordpress-files-pv
- spec:
- capacity:
- storage: 1Gi
- accessModes:
- - ReadWriteOnce
- hostPath:
- path: /var/lib/rancher/k3s/links/wordpress-files
- claimRef:
- name: wordpress-files-pvc
- namespace: default
- ---
- apiVersion: v1
- kind: PersistentVolumeClaim
- metadata:
- name: wordpress-files-pvc
- spec:
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: 1Gi
- volumeName: wordpress-files-pv
- ---
- apiVersion: v1
- kind: PersistentVolume
- metadata:
- name: wp-db-pv
- spec:
- capacity:
- storage: 1Gi
- accessModes:
- - ReadWriteOnce
- hostPath:
- path: /var/lib/rancher/k3s/links/wp_db
- claimRef:
- name: wp-db-pvc
- namespace: default
- ---
- apiVersion: v1
- kind: PersistentVolumeClaim
- metadata:
- name: wp-db-pvc
- spec:
- accessModes:
- - ReadWriteOnce
- resources:
- requests:
- storage: 1Gi
- volumeName: wp-db-pv
- ---
- apiVersion: apps/v1
- kind: Deployment
- metadata:
- name: wordpress
- labels:
- app: wordpress
- spec:
- replicas: 1
- selector:
- matchLabels:
- app: wordpress
- template:
- metadata:
- labels:
- app: wordpress
- spec:
- containers:
- - name: wordpress
- image: wordpress:latest
- ports:
- - containerPort: 80
- env:
- - name: WORDPRESS_DB_HOST
- value: "wp-db:3306"
- - name: WORDPRESS_DB_USER
- value: "wordpress"
- - name: WORDPRESS_DB_PASSWORD
- value: "YOUR_WORDPRESS_DB_PASSWORD" # Replace with your actual value or use a secret
- - name: WORDPRESS_DB_NAME
- value: "wordpress"
- volumeMounts:
- - name: wordpress-files
- mountPath: /var/www/html
- volumes:
- - name: wordpress-files
- persistentVolumeClaim:
- claimName: wordpress-files-pvc
- ---
- apiVersion: apps/v1
- kind: Deployment
- metadata:
- name: wp-db
- labels:
- app: wp-db
- spec:
- replicas: 1
- selector:
- matchLabels:
- app: wp-db
- template:
- metadata:
- labels:
- app: wp-db
- spec:
- containers:
- - name: wp-db
- image: mysql:9.2.0
- ports:
- - containerPort: 3306
- env:
- - name: MYSQL_ROOT_PASSWORD
- value: "YOUR_WORDPRESS_DB_ROOT_PASSWORD" # Replace with your actual value or use a secret
- - name: MYSQL_DATABASE
- value: "wordpress"
- - name: MYSQL_USER
- value: "wordpress"
- - name: MYSQL_PASSWORD
- value: "YOUR_WORDPRESS_DB_PASSWORD" # Replace with your actual value or use a secret
- volumeMounts:
- - name: db-data
- mountPath: /var/lib/mysql
- command: ["/bin/sh", "-c", "sleep infinity"]
- volumes:
- - name: db-data
- persistentVolumeClaim:
- claimName: wp-db-pvc
- ---
- apiVersion: v1
- kind: Service
- metadata:
- name: wordpress
- labels:
- app: wordpress
- spec:
- selector:
- app: wordpress
- ports:
- - protocol: TCP
- port: 80
- targetPort: 80
- type: ClusterIP
- ---
- apiVersion: v1
- kind: Service
- metadata:
- name: wp-db
- labels:
- app: wp-db
- spec:
- selector:
- app: wp-db
- ports:
- - protocol: TCP
- port: 3306
- targetPort: 3306
- type: ClusterIP
- ---
- apiVersion: networking.k8s.io/v1
- kind: Ingress
- metadata:
- name: wordpress-ingress
- annotations:
- nginx.ingress.kubernetes.io/rewrite-target: /
- spec:
- rules:
- - host: spidershomelab.xyz
- http:
- paths:
- - path: /
- pathType: Prefix
- backend:
- service:
- name: wordpress
- port:
- number: 80
Advertisement
Add Comment
Please, Sign In to add comment