You need to enable JavaScript to run this app.
导航
通过Helm CLI 部署 WordPress
最近更新时间:2024.01.09 10:16:06首次发布时间:2024.01.09 10:16:06

本文介绍在VKE中通过Helm CLI 部署 WordPress。

前言

在VKE中通过Helm CLI部署WordPress,并在浏览器访问。

关于实验

预计实验时间:30分钟
级别:初级
相关产品:VKE
受众: 通用

实验说明

如果还没有火山引擎账号,点击此[链接]注册账号
如果还没有VKE集群,参考此[链接]快速创建一个VKE

第一步、环境说明

kubernetes版本:v1.20.15-vke.2
1.安装helm CLI
参考helm官网
2.添加WordPress官方Repo地址

$ helm repo add bitnami https://charts.bitnami.com/bitnami
"bitnami" has been added to your repositories

3.查看Repo

$ helm repo list |grep bitnami
bitnami         https://charts.bitnami.com/bitnami

4.安装wordpress

$ helm install wordpress bitnami/wordpress --set service.type=NodePort --set service.nodePorts.http=32080 --set service.nodePorts.https=32443 --set mariadb.primary.persistence.enabled=false --set persistence.enabled=false -n wordpress
NAME: wordpress
LAST DEPLOYED: Thu Nov  3 18:07:53 2022
NAMESPACE: wordpress
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: wordpress
CHART VERSION: 15.2.10
APP VERSION: 6.1.0

** Please be patient while the chart is being deployed **

Your WordPress site can be accessed through the following DNS name from within your cluster:

    wordpress.wordpress.svc.cluster.local (port 80)

To access your WordPress site from outside the cluster follow the steps below:

1. Get the WordPress URL by running these commands:

   export NODE_PORT=$(kubectl get --namespace wordpress -o jsonpath="{.spec.ports[0].nodePort}" services wordpress)
   export NODE_IP=$(kubectl get nodes --namespace wordpress -o jsonpath="{.items[0].status.addresses[0].address}")
   echo "WordPress URL: http://$NODE_IP:$NODE_PORT/"
   echo "WordPress Admin URL: http://$NODE_IP:$NODE_PORT/admin"

2. Open a browser and access WordPress using the obtained URL.

3. Login with the following credentials below to see your blog:

  echo Username: user
  echo Password: $(kubectl get secret --namespace wordpress wordpress -o jsonpath="{.data.wordpress-password}" | base64 -d)

5.查看是否部署成功

$ helm list -n wordpress
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                   APP VERSION
wordpress       wordpress       1               2022-11-03 18:07:53.702376592 +0800 CST deployed        wordpress-15.2.10       6.1.0

6.查看pod

$ kubectl get pod -n wordpress 
NAME                         READY   STATUS    RESTARTS   AGE
wordpress-84d5844979-9pqpr   1/1     Running   0          61s
wordpress-mariadb-0          1/1     Running   0          2m2s

7.查看service

$ kubectl get svc -n wordpress 
NAME                TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)                      AGE
wordpress           NodePort    10.99.125.55   <none>        80:32080/TCP,443:32443/TCP   7m15s
wordpress-mariadb   ClusterIP   10.99.9.112    <none>        3306/TCP                     7m15s

8.浏览器访问
alt

参考链接

[1] https://bitnami.com/stack/wordpress/helm