New to KubeVault? Please start here.
Connect to Vault using AWS IAM Auth Method
The KubeVault operator uses an AppBinding to connect to an externally provisioned Vault server. For AWS IAM 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 specified secret must be in AppBinding’s namespace.
The type of the specified secret must be
"kubevault.com/aws"
.The specified secret data can have the following key:
Secret.Data["access_key_id"]
:Required
. Specifies AWS access key.Secret.Data["secret_access_key"]
:Required
. Specifies AWS access secret.Secret.Data["security_token"]
:Optional
. Specifies AWS security token.
The additional information required for AWS IAM authentication can be provided as AppBinding’s
spec.parameters
.spec: parameters: apiVersion: config.kubevault.com/v1alpha1 kind: VaultServerConfiguration path: my-aws vaultRole: demo aws: headerValue: vault.example.com
parameters.path
:optional
. Specifies the path where AWS auth is enabled in Vault. Default toaws
.parameters.vaultRole
:required
. Specifies the name of the Vault auth role against which login will be performed.parameters.aws.headerValue
:optional
. Specifies the header value that required if X-Vault-AWS-IAM-Server-ID Header is set in Vault.
Sample AppBinding and Secret is given below:
apiVersion: appcatalog.appscode.com/v1alpha1
kind: AppBinding
metadata:
name: vault-app
namespace: demo
spec:
secret:
name: aws-cred
parameters:
apiVersion: config.kubevault.com/v1alpha1
kind: VaultServerConfiguration
path: my-aws
vaultRole: demo
aws:
headerValue: vault.example.com
clientConfig:
service:
name: vault
scheme: HTTPS
port: 8200
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN1RENDQWFDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFOTVFzd0NRWURWUVFERXdKallUQWUKRncweE9ERXlNamN3TkRVNU1qVmFGdzB5T0RFeU1qUXdORFU1TWpWYU1BMHhDekFKQmdOVkJBTVRBbU5oTUlJQgpJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBMVhid2wyQ1NNc2VQTU5RRzhMd3dUVWVOCkI1T05oSTlDNzFtdUoyZEZjT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