0
点赞
收藏
分享

微信扫一扫

#我的新年Flag#hostPath存储

捌柒陆壹 2023-02-08 阅读 119
hostPath Volume

hostPath Volume 是指Pod挂载主机上的目录文件。
hostPath Volume 使得容器可以使用宿主机的文件系统进行存储

参考文件

https://kubernetes.io/docs/concepts/storage/volumes#hostpath

实例Yaml

[root@k8smaster4 dir]# cat hostpath.yaml 
apiVersion: v1
kind: Pod
metadata:
name: test
spec:
containers:
- name: test-nginx
image: docker.io/xianchao/nginx:v1
imagePullPolicy: IfNotPresent
volumeMounts:
- name: test-hostpath
mountPath: /usr/local/nginx/html/
- name: test-tomcat
image: docker.io/xianchao/tomcat-8.5-jre8:v1
imagePullPolicy: IfNotPresent
volumeMounts:
- name: test-hostpath
mountPath: /usr/local/tomcat/webapps/
volumes:
- name: test-hostpath
hostPath:
path: /data1
type: DirectoryOrCreate


举报

相关推荐

0 条评论