wordpress-deploy
Differences
This shows you the differences between two versions of the page.
| wordpress-deploy [2025/07/26 17:09] – - Imported by DokuWiki Advanced Plugin wikiadm | wordpress-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 bash> | ||
| - | $ kubectl apply -f namespace-wp.yaml | ||
| - | namespace/ | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ cat secret-wp | ||
| - | password=ga3isgBT4dXG | ||
| - | username=userwp | ||
| - | passworduser=ga3isgBT4dXG | ||
| - | database=wpdb | ||
| - | </ | ||
| - | |||
| - | <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 bash> | ||
| - | $ kubectl apply -f secret-wp.yaml | ||
| - | secret/ | ||
| - | </ | ||
| - | |||
| - | <file yaml mysql-claim.yaml> | ||
| - | apiVersion: v1 | ||
| - | kind: PersistentVolumeClaim | ||
| - | metadata: | ||
| - | name: mysql-pv-claim | ||
| - | namespace: wp-system | ||
| - | spec: | ||
| - | storageClassName: | ||
| - | accessModes: | ||
| - | - ReadWriteOnce | ||
| - | resources: | ||
| - | requests: | ||
| - | storage: 8Gi | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ kubectl apply -f mysql-pv-claim.yaml | ||
| - | persistentvolumeclaim/ | ||
| - | </ | ||
| - | |||
| - | <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: | ||
| - | 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: | ||
| - | name: mysql | ||
| - | volumeMounts: | ||
| - | - name: persistent-storage | ||
| - | mountPath: / | ||
| - | volumes: | ||
| - | - name: persistent-storage | ||
| - | persistentVolumeClaim: | ||
| - | claimName: mysql-pv-claim | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ kubectl apply -f mysql-wp.yaml | ||
| - | deployment.apps/ | ||
| - | </ | ||
| - | |||
| - | <file yaml mysql-service.yaml> | ||
| - | apiVersion: v1 | ||
| - | kind: Service | ||
| - | metadata: | ||
| - | name: mysql-wp | ||
| - | namespace: wp-system | ||
| - | spec: | ||
| - | ipFamilies: | ||
| - | - IPv4 | ||
| - | - IPv6 | ||
| - | ipFamilyPolicy: | ||
| - | ports: | ||
| - | - port: 3306 | ||
| - | selector: | ||
| - | app: wordpress | ||
| - | tier: mysql | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ kubectl apply -f mysql-service.yaml | ||
| - | service/ | ||
| - | </ | ||
| - | |||
| - | <file yaml wordpress-claim.yaml> | ||
| - | apiVersion: v1 | ||
| - | kind: PersistentVolumeClaim | ||
| - | metadata: | ||
| - | name: wordpress-pv-claim | ||
| - | namespace: wp-system | ||
| - | spec: | ||
| - | storageClassName: | ||
| - | accessModes: | ||
| - | - ReadWriteOnce | ||
| - | resources: | ||
| - | requests: | ||
| - | storage: 10Gi | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ kubectl apply -f wordpress-pv-claim.yaml | ||
| - | persistentvolumeclaim/ | ||
| - | </ | ||
| - | |||
| - | <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: | ||
| - | name: wordpress | ||
| - | env: | ||
| - | - name: WORDPRESS_DB_HOST | ||
| - | value: mysql-wp: | ||
| - | - 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: | ||
| - | name: wordpress | ||
| - | volumeMounts: | ||
| - | - name: persistent-storage | ||
| - | mountPath: / | ||
| - | volumes: | ||
| - | - name: persistent-storage | ||
| - | persistentVolumeClaim: | ||
| - | claimName: wordpress-pv-claim | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ kubectl apply -f wordpress.yaml | ||
| - | deployment.apps/ | ||
| - | </ | ||
| - | |||
| - | <file yaml wordpress-service.yaml> | ||
| - | apiVersion: v1 | ||
| - | kind: Service | ||
| - | metadata: | ||
| - | name: wordpress | ||
| - | namespace: wp-system | ||
| - | spec: | ||
| - | ipFamilies: | ||
| - | - IPv4 | ||
| - | - IPv6 | ||
| - | ipFamilyPolicy: | ||
| - | ports: | ||
| - | - port: 80 | ||
| - | selector: | ||
| - | app: wordpress | ||
| - | tier: web | ||
| - | type: LoadBalancer | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ kubectl apply -f wordpress-service.yaml | ||
| - | service/ | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ kubectl get secret, | ||
| - | NAME | ||
| - | secret/ | ||
| - | secret/ | ||
| - | |||
| - | NAME | ||
| - | persistentvolumeclaim/ | ||
| - | persistentvolumeclaim/ | ||
| - | |||
| - | NAME TYPE | ||
| - | service/ | ||
| - | service/ | ||
| - | |||
| - | NAME | ||
| - | pod/ | ||
| - | pod/ | ||
| - | </ | ||
| - | |||
| - | ===== Referências ===== | ||
| - | - [[https:// | ||
| - | - [[https:// | ||
wordpress-deploy.1753560545.txt.gz · Last modified: by wikiadm
