Is there a way to create a subdirectory of Kubernetes Secret?

Kubernetes Secrets creates files that are mounted as volumeMount .

It is possible to put several files in one secret.

Is there a way to create a secret that puts files in a directory structure (i.e. in a folder)?

There are no signs in the documents, and the use of the name is /not allowed in the key name, so it seems that this is impossible (except for creating several secrets and mounting them in different volumes)

Does anyone know better?

+4
source share
2 answers

, . , , , .

+4

: items, / . . " " , : https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-files-from-a-pod

apiVersion: v1
kind: Pod
metadata:
  name: mypod
spec:
  containers:
  - name: mypod
    image: redis
    volumeMounts:
    - name: foo
      mountPath: "/etc/foo"
      readOnly: true
  volumes:
  - name: foo
    secret:
      secretName: mysecret
      items:
      - key: username
        path: my-group/my-username

" " /my_secret_volume/my-group/my-username

+1

Source: https://habr.com/ru/post/1625412/


All Articles