如何解决如何使用卷和 volumeMounts 访问多个文件/机密?
我有几个文件作为 Kubernetes 机密存储。我可以访问其中之一,但显然我需要所有这些。我如何访问所有这些?我试过了,但它们似乎相互覆盖。
// In deployment
volumes:
- name: my-secret-volume
secret:
secretName: some-file.yaml
- name: my-secret-volume
secret:
secretName: another-file.yaml
...
volumeMounts:
- name: my-secret-volume
mountPath: /var/config
readOnly: true
解决方法
卷名称应该不同。此外,您应该只提供秘密名称而不是 yaml。您可以像下面这样使用:
volumes:
- name: my-secret-volume1
secret:
secretName: some-secret
- name: my-secret-volume2
secret:
secretName: another-secret
...
volumeMounts:
- name: my-secret-volume1
mountPath: /var/config
readOnly: true
- name: my-secret-volume2
mountPath: /var/config
readOnly: true
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。