wordpress部署

Posted zhugq02

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了wordpress部署相关的知识,希望对你有一定的参考价值。

1.nfs安装部署

master
ode上:
yum install -y nfs-utils-*
systemctl restart rpcbind
systemctl restart nfs
systemctl enable rpcbind
systemctl enable nfs
master:
mkdir /data    vim /etc/exports 
/data 10.0.0.0/24(rw,async,no_root_squash,no_all_squash)
/code 10.0.0.0/24(rw,async,no_root_squash,no_all_squash)

 2.yaml文件

1)pv
[root@k8s-m backup]# cat nfs_pv.yml 
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv0001
  labels:
    type: nfs001
spec:
  capacity:
    storage: 10Gi 
  accessModes:
    - ReadWriteMany 
  persistentVolumeReclaimPolicy: Recycle
  nfs:
    path: "/data"
    server: 10.0.0.11
    readOnly: false

[root@k8s-m backup]# cat wp_pv.yml 
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv0002
  labels:
    type: nfs002
spec:
  capacity:
    storage: 10Gi 
  accessModes:
    - ReadWriteMany 
  persistentVolumeReclaimPolicy: Recycle
  nfs:
    path: "/code"
    server: 10.0.0.11
    readOnly: false

2)pvc

[root@k8s-m backup]# cat nfs_
nfs_pvc.yml  nfs_pv.yml   nfs_rc.yml   nfs_svc.yml  
[root@k8s-m backup]# cat nfs_pvc.yml 
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pv0001
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
[root@k8s-m backup]# cat wp_pvc.yml 
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pv0002
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
[root@k8s-m backup]# cat nfs_rc.yml 
apiVersion: v1
kind: ReplicationController
metadata:
  name: mysql
spec:
  replicas: 1
  selector:
    app: mysql
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
      - name: mysql
        image: 10.0.0.11:5000/maxzhu/mysql:v1
        ports:
        - containerPort: 3306
        volumeMounts:
        - name: nfs-vol
          mountPath: /var/lib/mysql
        env:
        - name: MYSQL_ROOT_PASSWORD
          value: "abc123"
        - name: MYSQL_DATABASE
          value: "wordpress"
        - name: MYSQL_USER
          value: "wordpress"
        - name: MYSQL_PASSWORD
          value: "wordpress"
      volumes:
      - name: nfs-vol
        persistentVolumeClaim:
          claimName: pv0001
[root@k8s-m backup]# cat wp_rc.yml 
apiVersion: v1
kind: ReplicationController
metadata:
  name: myweb
spec:
  replicas: 1
  selector:
    app: myweb
  template:
    metadata:
      labels:
        app: myweb
    spec:
      containers:
      - name: myweb
        image: 10.0.0.11:5000/maxzhu/wordpress:v2
        ports:
        - containerPort: 80
        volumeMounts:
        - name: wp-vol
          mountPath: /var/www/html
        env:
        - name: WORDPRESS_DB_HOST
          value: ‘172.17.204.91‘ (**这个根据svc查看的)
        - name: WORDPRESS_DB_USER
          value: ‘wordpress‘
        - name: WORDPRESS_DB_PASSWORD
          value: ‘wordpress‘
      volumes:
      - name: wp-vol
        persistentVolumeClaim:
          claimName: pv0002

3)svc

[root@k8s-m backup]# 
[root@k8s-m backup]# cat nfs_svc.yml 
apiVersion: v1
kind: Service
metadata:
  name: mysql
spec:
  type: NodePort
  ports:
    - port: 3306
      nodePort: 30002
  selector:
    app: mysql

[root@k8s-m backup]# cat wp_svc.yml 
apiVersion: v1
kind: Service
metadata:
  name: myweb
spec:
  type: NodePort
  ports:
    - port: 80
      nodePort: 30008
  selector:
    app: myweb

  

以上是关于wordpress部署的主要内容,如果未能解决你的问题,请参考以下文章

Wordpress - 将代码片段包含到布局的选定部分的插件

PHP WordPress条件为主页SlideDeck主题代码片段

Wordpress阻止访问wp admin€“wpsnipp.com网站你博客的Wordpress代码片段

用于 WordPress 的 PHP 片段,用于获取所有产品子类别

导致资产预编译在heroku部署上失败的代码片段

javascript WordPress媒体库JS片段