标签:ssm cto erp utils 共享 mysql mode mes bin
yum install -y rpcbind nfs-utils
创建共享目录
mkdir /home/sharedir
修改目录权限
chmod 0755 -R sharedir
修改NFS配置文件
vi /etc/exports
/home/sharedir 192.168.2.0(rw,no_root_squash,no_all_squash,sync)
----------------------------
yum install -y nfs-utils
showmount -e 192.168.2.120
mkdir /mnt/sharedir
mount -t nfs 192.168.2.120:/home/sharedir /mnt/sharedir
----------------------------------------
pv创建配置
mysql-pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: mysql-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
nfs:
path: /home/sharedir/mysqldata
server: 192.168.2.120
----------------------------------------
pvc创建
mysql-pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
----------------------------------------
部署mysql
mysql.yaml
apiVersion: v1
kind: Service
metadata:
name: mysql
spec:
ports:
- port: 3306
selector:
app: mysql
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql
spec:
selector:
matchLabels:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
containers:
- name: mysql
image: mysql:5.6
env:
- name: MYSQL_ROOT_PASSWORD
value: password
ports:
- name: mysql
containerPort: 3306
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pvc
----------------------------------------
进入mysql容器:
kubectl run -it --rm --image=mysql:5.6 --restart=Never mysql-client -- mysql -h mysql -ppassword
标签:ssm cto erp utils 共享 mysql mode mes bin
原文地址:https://www.cnblogs.com/fourw/p/11460911.html