New to KubeVault? Please start here.

Connect to Vault using Userpass Auth Method

The KubeVault operator uses an AppBinding to connect to an externally provisioned Vault server. For Userpass authentication, it has to be enabled and configured in the Vault server. Follow the steps below to create an appropriate AppBinding:

  • You have to specify spec.secret in the AppBinding.

  • The type of the specified secret must be kubernetes.io/basic-auth.

  • The specified secret data must have the following key:

    • Secret.Data["username"] : Required. Specifies the username used for authentication.
    • Secret.Data["password"] : Required. Specifies the password used for authentication.
  • The specified secret must be in AppBinding’s namespace.

  • The additional information required for the Userpass authentication method can be provided as AppBinding’s spec.parameters.

      spec:
        parameters:
          apiVersion: config.kubevault.com/v1alpha1
          kind: VaultServerConfiguration
          path: my-userpass
    
    • path : optional. Specifies the path where the Userpass auth is enabled in Vault. If this path is not provided, the path will be set by default path userpass.

Sample AppBinding and Secret is given below:

apiVersion: appcatalog.appscode.com/v1alpha1
kind: AppBinding
metadata:
  name: vault-app
  namespace: demo
spec:
  secret:
    name: userpass-cred
  parameters:
    apiVersion: config.kubevault.com/v1alpha1
    kind: VaultServerConfiguration
    path: my-userpass
  clientConfig:
    service:
      name: vault
      scheme: HTTPS
      port: 8200
    caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN1RENDQWFDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFOTVFzd0NRWURWUVFERXdKallUQWUKRncweE9ERXlNamN3TkRVNU1qVmFGdzB5T0RFeU1qUXdORFU1TWpWYU1BMHhDekFKQmdOVkJBTVRBbU5oTUlJQgpJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBMVhid2wyQ1NNc2VQTU5RRzhMd3dUVWVOCkI1T05oSTlDNzFtdUoyZEZjTTlUc1VDQnlRRk1weUc5dWFvV3J1ZDhtSWpwMVl3MmVIUW5udmoybXRmWGcrWFcKSThCYkJUaUFKMWxMMFE5MlV0a1BLczlXWEt6dTN0SjJUR1hRRDhhbHZhZ0JrR1ViOFJYa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