Guest User

Untitled

a guest
Mar 20th, 2025
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.80 KB | None | 0 0
  1. ---
  2. apiVersion: v1
  3. kind: PersistentVolume
  4. metadata:
  5. name: wordpress-files-pv
  6. spec:
  7. capacity:
  8. storage: 1Gi
  9. accessModes:
  10. - ReadWriteOnce
  11. hostPath:
  12. path: /var/lib/rancher/k3s/links/wordpress-files
  13. claimRef:
  14. name: wordpress-files-pvc
  15. namespace: default
  16. ---
  17. apiVersion: v1
  18. kind: PersistentVolumeClaim
  19. metadata:
  20. name: wordpress-files-pvc
  21. spec:
  22. accessModes:
  23. - ReadWriteOnce
  24. resources:
  25. requests:
  26. storage: 1Gi
  27. volumeName: wordpress-files-pv
  28. ---
  29. apiVersion: v1
  30. kind: PersistentVolume
  31. metadata:
  32. name: wp-db-pv
  33. spec:
  34. capacity:
  35. storage: 1Gi
  36. accessModes:
  37. - ReadWriteOnce
  38. hostPath:
  39. path: /var/lib/rancher/k3s/links/wp_db
  40. claimRef:
  41. name: wp-db-pvc
  42. namespace: default
  43. ---
  44. apiVersion: v1
  45. kind: PersistentVolumeClaim
  46. metadata:
  47. name: wp-db-pvc
  48. spec:
  49. accessModes:
  50. - ReadWriteOnce
  51. resources:
  52. requests:
  53. storage: 1Gi
  54. volumeName: wp-db-pv
  55. ---
  56. apiVersion: apps/v1
  57. kind: Deployment
  58. metadata:
  59. name: wordpress
  60. labels:
  61. app: wordpress
  62. spec:
  63. replicas: 1
  64. selector:
  65. matchLabels:
  66. app: wordpress
  67. template:
  68. metadata:
  69. labels:
  70. app: wordpress
  71. spec:
  72. containers:
  73. - name: wordpress
  74. image: wordpress:latest
  75. ports:
  76. - containerPort: 80
  77. env:
  78. - name: WORDPRESS_DB_HOST
  79. value: "wp-db:3306"
  80. - name: WORDPRESS_DB_USER
  81. value: "wordpress"
  82. - name: WORDPRESS_DB_PASSWORD
  83. value: "YOUR_WORDPRESS_DB_PASSWORD" # Replace with your actual value or use a secret
  84. - name: WORDPRESS_DB_NAME
  85. value: "wordpress"
  86. volumeMounts:
  87. - name: wordpress-files
  88. mountPath: /var/www/html
  89. volumes:
  90. - name: wordpress-files
  91. persistentVolumeClaim:
  92. claimName: wordpress-files-pvc
  93. ---
  94. apiVersion: apps/v1
  95. kind: Deployment
  96. metadata:
  97. name: wp-db
  98. labels:
  99. app: wp-db
  100. spec:
  101. replicas: 1
  102. selector:
  103. matchLabels:
  104. app: wp-db
  105. template:
  106. metadata:
  107. labels:
  108. app: wp-db
  109. spec:
  110. containers:
  111. - name: wp-db
  112. image: mysql:9.2.0
  113. ports:
  114. - containerPort: 3306
  115. env:
  116. - name: MYSQL_ROOT_PASSWORD
  117. value: "YOUR_WORDPRESS_DB_ROOT_PASSWORD" # Replace with your actual value or use a secret
  118. - name: MYSQL_DATABASE
  119. value: "wordpress"
  120. - name: MYSQL_USER
  121. value: "wordpress"
  122. - name: MYSQL_PASSWORD
  123. value: "YOUR_WORDPRESS_DB_PASSWORD" # Replace with your actual value or use a secret
  124. volumeMounts:
  125. - name: db-data
  126. mountPath: /var/lib/mysql
  127. command: ["/bin/sh", "-c", "sleep infinity"]
  128. volumes:
  129. - name: db-data
  130. persistentVolumeClaim:
  131. claimName: wp-db-pvc
  132. ---
  133. apiVersion: v1
  134. kind: Service
  135. metadata:
  136. name: wordpress
  137. labels:
  138. app: wordpress
  139. spec:
  140. selector:
  141. app: wordpress
  142. ports:
  143. - protocol: TCP
  144. port: 80
  145. targetPort: 80
  146. type: ClusterIP
  147. ---
  148. apiVersion: v1
  149. kind: Service
  150. metadata:
  151. name: wp-db
  152. labels:
  153. app: wp-db
  154. spec:
  155. selector:
  156. app: wp-db
  157. ports:
  158. - protocol: TCP
  159. port: 3306
  160. targetPort: 3306
  161. type: ClusterIP
  162. ---
  163. apiVersion: networking.k8s.io/v1
  164. kind: Ingress
  165. metadata:
  166. name: wordpress-ingress
  167. annotations:
  168. nginx.ingress.kubernetes.io/rewrite-target: /
  169. spec:
  170. rules:
  171. - host: spidershomelab.xyz
  172. http:
  173. paths:
  174. - path: /
  175. pathType: Prefix
  176. backend:
  177. service:
  178. name: wordpress
  179. port:
  180. number: 80
  181.  
Advertisement
Add Comment
Please, Sign In to add comment