如果一个容器需要挂开多个已经存在的volume比如Secret、ConfigMap、DownwardAPI等,原本每个这种类型的volume需要各自占用一个挂载目录,而projected能将它们整合在一起,并只挂开到一个目录下,示例:
apiVersion: v1 kind: Pod metadata: name: volume-test spec: containers: - name: container-test image: busybox volumeMounts: - name: all-in-one mountPath: "/projected-volume" readOnly: true volumes: - name: all-in-one projected: sources: - secret: name: mysecret items: - key: username path: my-group/my-username - downwardAPI: items: - path: "labels" fieldRef: fieldPath: metadata.labels - path: "cpu_limit" resourceFieldRef: containerName: container-test resource: limits.cpu - configMap: name: myconfigmap items: - key: config path: my-group/my-configkubernetes对象之Volume (2)
内容版权声明:除非注明,否则皆为本站原创文章。