#wordpress

部署业务应用

首先,我们需要添加 WordPress 官方Repo地址:

  1. helm3 repo add bitnami https://charts.bitnami.com/bitnami

执行 Helm Install 部署 WordPress:

  1. helm3 install wordpress bitnami/wordpress \
  2. --set mariadb.primary.persistence.enabled=true \
  3. --set mariadb.primary.persistence.storageClass=alicloud-disk-ssd \
  4. --set mariadb.primary.persistence.size=20Gi \
  5. --set persistence.enabled=false

其中:

  • 为了实现数据的持久化,mariadb 使用持久化存储卷保存数据;
  • 持久化存储选用阿里云 ssd 云盘,大小为 20Gi,并通过配置 StorageClassName 自动化创建;
  • WordPress 不需要进行数据持久化,数据卷选项可配置为 false

执行成功后,应该有如下返回:

  1. NAME: wordpress
  2. LAST DEPLOYED: Wed Jan 20 15:09:45 2021
  3. NAMESPACE: handsonack
  4. STATUS: deployed
  5. REVISION: 1
  6. NOTES:
  7. ** Please be patient while the chart is being deployed **
  8. Your WordPress site can be accessed through the following DNS name from within your cluster:
  9. wordpress.handsonack.svc.cluster.local (port 80)
  10. To access your WordPress site from outside the cluster follow the steps below:
  11. 1. Get the WordPress URL by running these commands:
  12. NOTE: It may take a few minutes for the LoadBalancer IP to be available.
  13. Watch the status with: 'kubectl get svc --namespace handsonack -w wordpress'
  14. export SERVICE_IP=$(kubectl get svc --namespace handsonack wordpress --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}")
  15. echo "WordPress URL: http://$SERVICE_IP/"
  16. echo "WordPress Admin URL: http://$SERVICE_IP/admin"
  17. 2. Open a browser and access WordPress using the obtained URL.
  18. 3. Login with the following credentials below to see your blog:
  19. echo Username: user
  20. echo Password: $(kubectl get secret --namespace handsonack wordpress -o jsonpath="{.data.wordpress-password}" | base64 --decode)

也可以通过以下命令查看部署状态:

  1. helm3 status wordpress