You are looking at the documentation of a prior release. To read the documentation of the latest release, please visit here.

New to KubeVault? Please start here.

Connect to Vault using Azure Auth Method

The KubeVault operator uses an AppBinding to connect to an externally provisioned Vault server. For Azure 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 the k8s secret name in spec.secret in the AppBinding.

  • The specified secret must be in AppBinding’s namespace.

  • The type of the specified secret must be "kubevault.com/azure".

  • The specified secret data can have the following key:

    • Secret.Data["msiToken"] : Required. Signed JSON Web Token (JWT) from Azure MSI. Documentation can be found in here
  • The additional information required for the Azure authentication method can be provided as AppBinding’s spec.parameters.

    spec:
      parameters:
        apiVersion: config.kubevault.com/v1alpha1
        kind: VaultServerConfiguration
        path: my-azure
        vaultRole: demo-role
        azure:
          subscriptionID: 1bfc9f66-316d-433e-b13d-c55589f642ca
          resourceGroupName: vault-test
          vmName: test
          vmssName: test-set
    
    • path : optional. Specifies the path where Azure auth is enabled in Vault. If this path is not provided, the path will be set by default path azure.
    • vaultRole : required. Specifies the name of the Vault auth role against which login will be performed.
    • azure.subscriptionID : optional. Specifies the subscription ID for the machine that generated the MSI token. This information can be obtained through instance metadata.
    • azure.resourceGroupName : optional. Specifies the resource group for the machine that generated the MSI token. This information can be obtained through instance metadata.
    • azure.vmName : optional. Specifies the virtual machine name for the machine that generated the MSI token. This information can be obtained through instance metadata. If vmssName is provided, this value is ignored.
    • azure.vmssName : optional. Specifies the virtual machine scale set name for the machine that generated the MSI token. This information can be obtained through instance metadata.

Sample AppBinding and Secret is given below:

apiVersion: appcatalog.appscode.com/v1alpha1
kind: AppBinding
metadata:
  name: vault-app
  namespace: demo
spec:
  secret:
    name: azure-cred
  parameters:
    apiVersion: config.kubevault.com/v1alpha1
    kind: VaultServerConfiguration
    path: my-azure
    vaultRole: demo-role
    azure:
      subscriptionID: 1bfc9f66-316d-433e-b13d-c55589f642ca
      resourceGroupName: vault-test
      vmName: test
      vmssName: test-set
  clientConfig:
    service:
      name: vault
      scheme: HTTPS
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