kubernetes-helm - 如何在 HelmV3 中正确声明卷?
问题描述
我目前正在努力将 Helm 图表从 Helm V2 修改为 Helm V3,但我遇到了许多兼容性错误。
我有这样的 configmap 声明:
ConfigMap:
data.properties: |
data1: my_data
data2: my beautiful_data
data3: my wonderful_data
config.properties: |
config1: my_config
config2: my_beautiful_config
config3: my_wonderful_config
直到现在我这样宣布我的卷:
volumes:
- name: configmap-config
configMap:
name: "config-configmap"
key: config.properties
path: config.properties
- name: configmap-data
configMap:
name: "data-configmap"
key: data.properties
path: data.properties
但是使用 Helm V3 我得到了这个错误:
[ValidationError(Deployment.spec.template.spec.volumes[0].configMap): unknown field \"key\" in io.k8s.api.core.v1.ConfigMapVolumeSource,
ValidationError(Deployment.spec.template.spec.volumes[0].configMap): unknown field \"path\" in io.k8s.api.core.v1.ConfigMapVolumeSource,
我进行了多次搜索,但没有找到解释 V2 中的图表和 V3 中的图表之间差异的文档。如何在 Helm V3 中使用此 configmap 声明卷?
解决方案
这不是 helm 版本的真正问题。我想这与您的 kubernetes yaml 文件有关。使用卷挂载配置映射的正确方法
volumes:
- name: data
emptyDir: {}
- name: config
configMap:
name: example-redis-config
items:
- key: redis-config
path: redis.conf
我不确定为什么它可以与 helm v2 一起使用,但请尝试更新您的 yaml 文件
推荐阅读
- json - 泛型类的 Newtonsoft.DeserializeObject
- reactjs - ReactJS“不是构造函数”类型错误(CARTO.JS)
- python - 如何使用 Pydub 更改音频播放速度?
- c++ - 来自二维数组的 C++ 16 位灰度渐变图像
- ios - 当我折叠/展开屏幕时 displayModeButtonItem 正在消失
- jenkins - 我们可以使用 chef 作为持续部署工具吗?
- loops - 当列表以逗号开头时在列表中查找特定实例
- ssh - TFS - “运行 SSH 任务”选项超时
- chromium-embedded - 如何在 MacOS 上完全退出 CefClient
- docker - 为什么直接输入在harbor中不起作用?