码迷,mamicode.com
首页 > 其他好文 > 详细

wordpress部署

时间:2020-06-19 11:46:36      阅读:57      评论:0      收藏:0      [点我收藏+]

标签:mount   smo   readwrite   epo   style   sql   ado   requests   html   

1.nfs安装部署

master\node上:
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部署

标签:mount   smo   readwrite   epo   style   sql   ado   requests   html   

原文地址:https://www.cnblogs.com/zhugq02/p/13162035.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!