kubernetes - 如何在kubernetes的volume中映射当前目录?
问题描述
我需要将当前目录映射到 Windows 上的 Kubernetes 卷。
我可以使用 hostPath 来做到这一点,但我无法在我的部署中获取当前目录。
通常我们使用 ./ 来传递当前目录但 kubernetes 无法识别它。
如何在 windows kubernetes 中使用相应的 ./?
这是我尝试做的方式:
apiVersion: apps/v1
kind: Deployment
metadata:
name: testeleitor
labels:
app: leitoreventos
spec:
selector:
matchLabels:
app: leitoreventos
tier: backend
replicas: 1
template:
metadata:
labels:
app: leitoreventos
tier: backend
spec:
restartPolicy: Always
containers:
- image: leitordeeventos:v1.6.1
name: leitor
ports:
- containerPort: 5555
volumeMounts:
- mountPath: /home/binarios/test/
name: test-volume
volumes:
- name: test-volume
hostPath:
path: ./test/
type: Directory
解决方案
推荐阅读
- python - 让python3程序按“回车”多次
- javascript - 尝试在本地计算机上为 NEM 创建多重签名帐户但出现错误
- angularjs - 如何在指令中使用控制器范围而不在指令中使用控制器选项
- c# - 如何在c#中过滤包含url的DataRow列
- tensorflow - 如何使用 tf.estimator 保存张量流模型
- python-3.x - 从 Kubernetes pod 修改文件
- excel - VBA代码突出显示不包含特定文本的单元格
- tsql - 将 SQL Server 表中的行转换为列
- node.js - 在 Jest 中测试失败时如何打印请求和响应?
- asp.net - 如何在窗口警报后禁用浏览器后退按钮