k8s文件挂载
1在所有节点都要安装nfs工具yum install -y nfs-utils2挂载的服务端yum install -y nfs-utils# 暴露启动挂载的路径vi /etc/exports# ------------/data/nfs *(rw,no_root_squash)# ------------systemctl start nfsps -ef |gre...
1在所有节点都要安装nfs工具
yum install -y nfs-utils
2挂载的服务端
yum install -y nfs-utils
# 暴露启动挂载的路径
vi /etc/exports
# ------------
/data/nfs *(rw,no_root_squash)
# ------------
systemctl start nfs
ps -ef |grep nfs
用nginx用户创建文件
su - nginx
3可以配置pv 和pvc,这里直接在pod上挂载(应该注意文件权限,最好用nginx用户来创建)
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14
ports:
- containerPort: 80
volumeMounts:
- mountPath: /usr/share/nginx/html
name: nginx-html
volumes:
- name: nginx-html
nfs:
server: 10.0.2.15
path: /nfs
更多推荐
所有评论(0)