YAML secret deployment example

To add a secret by uploading a YAML file, the file content must meet the requirements of Kubernetes for secrets (see https://kubernetes.io/docs/concepts/configuration/secret/).

The following is an example of the YAML file:

apiVersion: v1    # Required. Specify the API version, which is fixed at v1.

kind: Secret    # Required. Specify the secret type.

metadata:

  name: secret-sa-sample    # Required. Enter a secret name

  namespace: default    # Required. Specify a namespace.

type: Opaque    # Required. Specify the secret type. The default secret type is Opaque.

data:    # Data key-value pair to be mounted. The key is defined by the user, and the value is a value encoded by base64.

  app-data: dGVzdA==

  extra: YmFyCg==