Inject Secrets from 1Password

This guide shows you how to pull a secret out of 1Password and into your application, using the onepassword dependency engine.

Maps items from 1Password into Kubernetes secrets. Each top-level key under
secrets becomes one Kubernetes secret in your application's namespace.

Two declaration styles are accepted and they do the same thing. Use the list
style when the key name in Kubernetes differs from the 1Password property name,
or when you want the mapping to be explicit. Use the dictionary style as a
shorthand for straightforward one-to-one mappings.

dependency:
  onepassword:
    secrets:
      # List style — explicit secretKey to remoteRef mapping
      db-credentials-secret:
        - secretKey: spring.datasource.username
          remoteRef:
            key: db-credentials
            property: username
        - secretKey: spring.datasource.password
          remoteRef:
            key: db-credentials
            property: password

      # Dictionary style — shorthand key: item/property
      db-credentials-short:
        spring.datasource.username: db-credentials/username
        spring.datasource.password: db-credentials/password

Related articles


Did this page help you?