Home > database >  how can I provide multipe secrets in one yaml file?
how can I provide multipe secrets in one yaml file?

Time:04-27

How can I define multiple secrets in one file? Seems that providing multiple secrets doesn't work.

apiVersion: v1
kind: Secret
metadata:
  name: ca-secret
  labels:
    app.kubernetes.io/managed-by: Helm
type: kubernetes.io/tls
data:
  tls.crt: LS0tLDR
  tls.key: LS0tLDR
apiVersion: v1
kind: Secret
metadata:
  name: envoy-secret
  labels:
    app.kubernetes.io/managed-by: Helm
type: kubernetes.io/tls
data:
  tls.crt: LS0tLS1
  tls.key: LS0tLS1

I am not able to use multiple files because I need to generate a single template using helm.

CodePudding user response:

You can have separate manifests in one yaml file by separating them with ---. This will work:

apiVersion: v1
kind: Secret
metadata:
  name: ca-secret
  labels:
    app.kubernetes.io/managed-by: Helm
type: kubernetes.io/tls
data:
  tls.crt: LS0tLDR
  tls.key: LS0tLDR
---
apiVersion: v1
kind: Secret
metadata:
  name: envoy-secret
  labels:
    app.kubernetes.io/managed-by: Helm
type: kubernetes.io/tls
data:
  tls.crt: LS0tLS1
  tls.key: LS0tLS1
  • Related