51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

在k8S集群部署wordpress案例

在k8S集群部署wordpress案例

1.编写资源清单

[root@master231 pod]# cat 03-pods-wordpress.yaml 
apiVersion: v1
kind: Pod
metadata:
  name: baimei-wp
spec:
  hostNetwork: true
  nodeName: worker233
  containers: 
  - name: db
    image: harbor.baimei.com/baimei-db/mysql:5.7
    # 向容器传递环境变量
    env:
      # 变量的名称
    - name: MYSQL_ALLOW_EMPTY_PASSWORD
      # 指定变量的值
      value: "yes"
    - name: MYSQL_DATABASE
      value: "wordpress"
    - name: MYSQL_USER
      value: "admin"
    - name: MYSQL_PASSWORD
      value: "baimei"
  - name: wp
    image: harbor.baimei.com/baimei-wordpress/wordpress:latest
    env:
    - name: WORDPRESS_DB_HOST
      value: "127.0.0.1"
    - name: WORDPRESS_DB_USER
      value: "admin"
    - name: WORDPRESS_DB_PASSWORD
      value: "baimei"
    - name: WORDPRESS_DB_NAME
      value: "wordpress"

2.创建Pod

kubectl get pods

kubectl apply -f 03-pods-wordpress.yaml 

kubectl get pods -o wide

3.访问WordPress的WebUI

http://10.0.0.233/

赞(7)
未经允许不得转载:工具盒子 » 在k8S集群部署wordpress案例