User Tools

Site Tools


wordpress-deploy

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wordpress-deploy [2025/07/26 17:09] – - Imported by DokuWiki Advanced Plugin wikiadmwordpress-deploy [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-====== WordPress Deployment ====== 
-<file bash> 
-$ kubectl create namespace wp-system -o yaml \ 
---dry-run=client > namespace-wp.yaml 
-</file> 
- 
-<file bash> 
-$ kubectl apply -f namespace-wp.yaml 
-namespace/wp-system created 
-</file> 
- 
-<file bash> 
-$ cat secret-wp 
-password=ga3isgBT4dXG 
-username=userwp 
-passworduser=ga3isgBT4dXG 
-database=wpdb 
-</file> 
- 
-<file bash> 
-$ kubectl create secret generic secret-wp -n wp-system \ 
---from-env-file=secret-wp -o yaml \ 
---dry-run=client > secret-wp.yaml 
-</file> 
- 
-<file bash> 
-$ kubectl apply -f secret-wp.yaml 
-secret/secret-wp created 
-</file> 
- 
-<file yaml mysql-claim.yaml> 
-apiVersion: v1 
-kind: PersistentVolumeClaim 
-metadata: 
-  name: mysql-pv-claim 
-  namespace: wp-system 
-spec: 
-  storageClassName: nfs-client 
-  accessModes: 
-    - ReadWriteOnce 
-  resources: 
-    requests: 
-      storage: 8Gi 
-</file> 
- 
-<file bash> 
-$ kubectl apply -f mysql-pv-claim.yaml 
-persistentvolumeclaim/mysql-pv-claim created 
-</file> 
- 
-<file yaml mysql-wp.yaml> 
-apiVersion: apps/v1 
-kind: Deployment 
-metadata: 
-  name: mysql-wp 
-  namespace: wp-system 
-spec: 
-  selector: 
-    matchLabels: 
-      app: wordpress 
-      tier: mysql 
-  strategy: 
-    type: Recreate 
-  template: 
-    metadata: 
-      labels: 
-        app: wordpress 
-        tier: mysql 
-    spec: 
-      containers: 
-      - image: mysql:latest 
-        name: mysql 
-        env: 
-        - name: MYSQL_ROOT_PASSWORD 
-          valueFrom: 
-            secretKeyRef: 
-              name: secret-wp 
-              key: password 
-        - name: MYSQL_USER 
-          valueFrom: 
-            secretKeyRef: 
-              name: secret-wp 
-              key: username 
-        - name: MYSQL_PASSWORD 
-          valueFrom: 
-            secretKeyRef: 
-              name: secret-wp 
-              key: passworduser 
-        - name: MYSQL_DATABASE 
-          valueFrom: 
-            secretKeyRef: 
-              name: secret-wp 
-              key: database 
-        ports: 
-        - containerPort: 3306 
-          name: mysql 
-        volumeMounts: 
-        - name: persistent-storage 
-          mountPath: /var/lib/mysql 
-      volumes: 
-      - name: persistent-storage 
-        persistentVolumeClaim: 
-          claimName: mysql-pv-claim 
-</file> 
- 
-<file bash> 
-$ kubectl apply -f mysql-wp.yaml 
-deployment.apps/mysql-wp created 
-</file> 
- 
-<file yaml mysql-service.yaml> 
-apiVersion: v1 
-kind: Service 
-metadata: 
-  name: mysql-wp 
-  namespace: wp-system 
-spec: 
-  ipFamilies: 
-  - IPv4 
-  - IPv6 
-  ipFamilyPolicy: PreferDualStack 
-  ports: 
-    - port: 3306 
-  selector: 
-    app: wordpress 
-    tier: mysql 
-</file> 
- 
-<file bash> 
-$ kubectl apply -f mysql-service.yaml 
-service/mysql-wp created 
-</file> 
- 
-<file yaml wordpress-claim.yaml> 
-apiVersion: v1 
-kind: PersistentVolumeClaim 
-metadata: 
-  name: wordpress-pv-claim 
-  namespace: wp-system 
-spec: 
-  storageClassName: nfs-client 
-  accessModes: 
-    - ReadWriteOnce 
-  resources: 
-    requests: 
-      storage: 10Gi 
-</file> 
- 
-<file bash> 
-$ kubectl apply -f wordpress-pv-claim.yaml 
-persistentvolumeclaim/wordpress-pv-claim created 
-</file> 
- 
-<file yaml wordpress.yaml> 
-apiVersion: apps/v1 
-kind: Deployment 
-metadata: 
-  name: wordpress 
-  namespace: wp-system 
-spec: 
-  selector: 
-    matchLabels: 
-      app: wordpress 
-      tier: web 
-  strategy: 
-    type: Recreate 
-  template: 
-    metadata: 
-      labels: 
-        app: wordpress 
-        tier: web 
-    spec: 
-      containers: 
-      - image: wordpress:php8.1-apache 
-        name: wordpress 
-        env: 
-        - name: WORDPRESS_DB_HOST 
-          value: mysql-wp:3306 
-        - name: WORDPRESS_DB_PASSWORD 
-          valueFrom: 
-            secretKeyRef: 
-              name: secret-wp 
-              key: passworduser 
-        - name: WORDPRESS_DB_USER 
-          valueFrom: 
-            secretKeyRef: 
-              name: secret-wp 
-              key: username 
-        - name: WORDPRESS_DB_NAME 
-          valueFrom: 
-            secretKeyRef: 
-              name: secret-wp 
-              key: database 
-        ports: 
-        - containerPort: 80 
-          name: wordpress 
-        volumeMounts: 
-        - name: persistent-storage 
-          mountPath: /var/www/html 
-      volumes: 
-      - name: persistent-storage 
-        persistentVolumeClaim: 
-          claimName: wordpress-pv-claim 
-</file> 
- 
-<file bash> 
-$ kubectl apply -f wordpress.yaml 
-deployment.apps/wordpress created 
-</file> 
- 
-<file yaml wordpress-service.yaml> 
-apiVersion: v1 
-kind: Service 
-metadata: 
-  name: wordpress 
-  namespace: wp-system 
-spec: 
-  ipFamilies: 
-  - IPv4 
-  - IPv6 
-  ipFamilyPolicy: PreferDualStack 
-  ports: 
-    - port: 80 
-  selector: 
-    app: wordpress 
-    tier: web 
-  type: LoadBalancer 
-</file> 
- 
-<file bash> 
-$ kubectl apply -f wordpress-service.yaml 
-service/wordpress created 
-</file> 
- 
-<file bash> 
-$ kubectl get secret,pvc,svc,po -n wp-system 
-NAME                         TYPE                                  DATA   AGE 
-secret/default-token-vdwc6   kubernetes.io/service-account-token        15m 
-secret/secret-wp             Opaque                                4      10m 
- 
-NAME                                       STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE 
-persistentvolumeclaim/mysql-pv-claim       Bound    pvc-4005b124-87e7-4f60-affa-42dbd0e9c62b   8Gi        RWO            nfs-client     7m49s 
-persistentvolumeclaim/wordpress-pv-claim   Bound    pvc-9fbc4a89-fc55-4337-94da-7bc6036fdea0   10Gi       RWO            nfs-client     3m41s 
- 
-NAME                TYPE           CLUSTER-IP      EXTERNAL-IP                              PORT(S)        AGE 
-service/mysql-wp    ClusterIP      10.96.209.235   <none>                                   3306/TCP       5m3s 
-service/wordpress   LoadBalancer   10.96.228.221   172.28.128.117,2804:694:4c00:4007::117   80:32129/TCP   56s 
- 
-NAME                             READY   STATUS    RESTARTS   AGE 
-pod/mysql-wp-749d4f59cc-2l7ql    1/1     Running            6m8s 
-pod/wordpress-565685f8fc-knkvt   1/    Running            2m3s 
-</file> 
- 
-===== Referências ===== 
-  - [[https://sesamedisk.com/deploy-wordpress-on-k8s/|Deploy WordPress on K8s]] 
-  - [[https://hub.docker.com/_/wordpress|wordpress]] 
  
wordpress-deploy.1753560545.txt.gz · Last modified: by wikiadm