Creare un ruolo IAM e un segreto AWS
Puoi configurare i pod Kubernetes in modo che accedano alle risorse AWS autenticandosi come ruolo AWS IAM invece di fornire credenziali AWS esplicite.
|
Per eseguire l'autenticazione usando un ruolo AWS IAM, devi disporre di un cluster Kubernetes implementato utilizzando EKS. |
Crea un segreto per AWS Secret Manager
Questo esempio crea un segreto per il manager segreto AWS per memorizzare le credenziali Astra Trident CSI:
aws secretsmanager create-secret --name trident-secret --description "Trident CSI credentials" --secret-string "{"user":"vsadmin","password":"<svmpassword>"}"
Crea criterio IAM
I seguenti esempi creano una policy IAM utilizzando l'interfaccia a riga di comando di AWS:
aws iam create-policy --policy-name AmazonFSxNCSIDriverPolicy --policy-document file://policy.json --description "This policy grants access to Trident CSI to FSxN and Secret manager"
Policy JSON file:
policy.json: { "Statement": [ { "Action": [ "fsx:DescribeFileSystems", "fsx:DescribeVolumes", "fsx:CreateVolume", "fsx:RestoreVolumeFromSnapshot", "fsx:DescribeStorageVirtualMachines", "fsx:UntagResource", "fsx:UpdateVolume", "fsx:TagResource", "fsx:DeleteVolume" ], "Effect": "Allow", "Resource": "*" }, { "Action": "secretsmanager:GetSecretValue", "Effect": "Allow", "Resource": "arn:aws:secretsmanager:<aws-region>:<aws-account-id>:secret:<aws-secret-manager-name>" } ], "Version": "2012-10-17" }
Creare e il ruolo IAM per l'account del servizio
Nell'esempio seguente viene creato un ruolo IAM per l'account di servizio in EKS:
eksctl create iamserviceaccount --name trident-controller --namespace trident --cluster <my-cluster> --role-name <AmazonEKS_FSxN_CSI_DriverRole> --role-only --attach-policy-arn arn:aws:iam::aws:policy/service-role/AmazonFSxNCSIDriverPolicy --approve