I am trying setup Couchbase backup to AWS S3 following the document https://docs.couchbase.com/operator/current/howto-backup.html
Kubernetes (EKS) cluster setup in AWS and deployed Couchbase cluster enterprises.
I wanted to store my Cluster backup to S3. The document says Kubernetes secrets with aws user key/secret/region is a must. However, it also says a backup service account with an IAM role attached to the node is sufficient - confused.
Can I avoid AWS user creation and storing that in secret by using AWS role with metadata authentication for this purpose?
apiVersion: couchbase.com/v2
kind: CouchbaseBackup
metadata:
name: couchbase-backup-fulls3
namespace: couchbase
spec:
strategy: immediate_full
size: 100Gi
storageClassName: couchbase-backup-sc
ephemeralVolume: true
services:
data: True
bucketConfig: True
objectStore:
useIAM: true
#secret: s3-region-secret <----- Want to avoid this?
uri: s3://couchbase-backup-<evironment>
I was able to figure this out. The answer is Yes, you can use the eks backup-service account attached to the AWS Role for couchbase backup to S3. No user account credentials are set up as Kubernetes secrets.
Since I use Terraform to do, I am posting the backup service account and role attachments via terraform below. You can use eksctl command to attach your custom policy, for example.
eksctl create iamserviceaccount --name backup-service-accountName --namespace some-namespace --region your-region --cluster clustername --attach-policy-arn your-policy-arn --approve --override-existing-serviceaccounts
Here is the Terraform code I used
Note: My Couchbase cluster environment setup is in AWS China, you will see aws partition as aws-cn.