我需要将我的本地机器中的一个目录与我的kubernetes集群内运行的docker容器中存在的一个目录进行映射。谁能帮帮我?
host dir : /opt/dev/project1
kube image location: /var/logs
你可以把你的主机目录挂载到kubernetes pod中,使用的是 主机路径
apiVersion: v1
kind: Pod
metadata:
name: test-pd
spec:
containers:
- image: k8s.gcr.io/test-webserver
name: test-container
volumeMounts:
- mountPath: /var/logs
name: test-volume
volumes:
- name: test-volume
hostPath:
# directory location on host
path: /opt/dev/project1
# this field is optional
type: Directory