hostpath:多个容器共享数据,不能跨宿主机,如果宿主机挂了,在其他宿主机上起pod,那么之前的数据就没有了
spec:
nodeName: 10.0.0.12
volumes:
- name: mysql
hostPath:
path: /data/wp_mysql
containers:
-name: wp-mysql
image: 10.0.0.11:5000/mysql:5.7
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3306
volumeMounts:
- name: mysql
mountPath: /var/lib/mysql
volumes:
- name: mysql
nfs:
path: /data/wp_mysql
server: 10.0.0.11