|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * storage/persistent_storage/persistent-storage-csi-aws-efs.adoc |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="efs-sts_{context}"] |
| 7 | += Configuring AWS EFS CSI Driver Operator with Secure Token Service |
| 8 | + |
| 9 | +This procedure explains how to configure the AWS EFS CSI Driver Operator with {product-title} on AWS Secure Token Service (STS). |
| 10 | + |
| 11 | +Perform this procedure after installing the AWS EFS CSI Operator, but before installing the AWS EFS CSI driver as part of _Installing the AWS EFS CSI Driver Operator_ procedure. If you perform this procedure after installing the driver and creating volumes, your volumes will fail to mount into pods. |
| 12 | + |
| 13 | +.Prerequisites |
| 14 | + |
| 15 | +* AWS account credentials |
| 16 | +
|
| 17 | +.Procedure |
| 18 | + |
| 19 | +To configure the AWS EFS CSI Driver Operator with STS: |
| 20 | + |
| 21 | +. Extract the CCO utility (`ccoctl`) binary from the {product-title} release image, which you used to install the cluster with STS. For more information, see "Configuring the Cloud Credential Operator utility". |
| 22 | + |
| 23 | +. Create and save an EFS `CredentialsRequest` YAML file, such as shown in the following example, and then place it in the `credrequests` directory: |
| 24 | ++ |
| 25 | +.Example |
| 26 | ++ |
| 27 | +[source, yaml] |
| 28 | +---- |
| 29 | +apiVersion: cloudcredential.openshift.io/v1 |
| 30 | +kind: CredentialsRequest |
| 31 | +metadata: |
| 32 | + name: openshift-aws-efs-csi-driver |
| 33 | + namespace: openshift-cloud-credential-operator |
| 34 | +spec: |
| 35 | + providerSpec: |
| 36 | + apiVersion: cloudcredential.openshift.io/v1 |
| 37 | + kind: AWSProviderSpec |
| 38 | + statementEntries: |
| 39 | + - action: |
| 40 | + - elasticfilesystem:* |
| 41 | + effect: Allow |
| 42 | + resource: '*' |
| 43 | + secretRef: |
| 44 | + name: aws-efs-cloud-credentials |
| 45 | + namespace: openshift-cluster-csi-drivers |
| 46 | + serviceAccountNames: |
| 47 | + - aws-efs-csi-driver-operator |
| 48 | + - aws-efs-csi-driver-controller-sa |
| 49 | +---- |
| 50 | + |
| 51 | +. Run the `ccoctl` tool to generate a new IAM role in AWS, and create a YAML file for it in the local file system (`<path_to_ccoctl_output_dir>/manifests/openshift-cluster-csi-drivers-aws-efs-cloud-credentials-credentials.yaml`). |
| 52 | ++ |
| 53 | +[source, terminal] |
| 54 | +---- |
| 55 | +$ ccoctl aws create-iam-roles --name=<name> --region=<aws_region> --credentials-requests-dir=<path_to_directory_with_list_of_credentials_requests>/credrequests --identity-provider-arn=arn:aws:iam::<aws_account_id>:oidc-provider/<name>-oidc.s3.<aws_region>.amazonaws.com |
| 56 | +---- |
| 57 | ++ |
| 58 | +* `name=<name>` is the name used to tag any cloud resources that are created for tracking. |
| 59 | +
|
| 60 | +* `region=<aws_region>` is the AWS region where cloud resources are created. |
| 61 | +
|
| 62 | +* `dir=<path_to_directory_with_list_of_credentials_requests>/credrequests` is the directory containing the EFS CredentialsRequest file in previous step. |
| 63 | +
|
| 64 | +* `<aws_account_id>`` is the AWS account ID. |
| 65 | ++ |
| 66 | +.Example |
| 67 | ++ |
| 68 | +[source, terminal] |
| 69 | +---- |
| 70 | +$ ccoctl aws create-iam-roles --name my-aws-efs --credentials-requests-dir credrequests --identity-provider-arn arn:aws:iam::123456789012:oidc-provider/my-aws-efs-oidc.s3.us-east-2.amazonaws.com |
| 71 | +---- |
| 72 | ++ |
| 73 | +.Example output |
| 74 | ++ |
| 75 | +[source, terminal] |
| 76 | +---- |
| 77 | +2022/03/21 06:24:44 Role arn:aws:iam::123456789012:role/my-aws-efs -openshift-cluster-csi-drivers-aws-efs-cloud- created |
| 78 | +2022/03/21 06:24:44 Saved credentials configuration to: /manifests/openshift-cluster-csi-drivers-aws-efs-cloud-credentials-credentials.yaml |
| 79 | +2022/03/21 06:24:45 Updated Role policy for Role my-aws-efs-openshift-cluster-csi-drivers-aws-efs-cloud- |
| 80 | +---- |
| 81 | +
|
| 82 | +. Create the AWS EFS cloud credentials and secret: |
| 83 | ++ |
| 84 | +[source, terminal] |
| 85 | +---- |
| 86 | +$ oc create -f <path_to_ccoctl_output_dir>/manifests/openshift-cluster-csi-drivers-aws-efs-cloud-credentials-credentials.yaml |
| 87 | +---- |
| 88 | ++ |
| 89 | +.Example |
| 90 | ++ |
| 91 | +[source, terminal] |
| 92 | +---- |
| 93 | +$ oc create -f /manifests/openshift-cluster-csi-drivers-aws-efs-cloud-credentials-credentials.yaml |
| 94 | +---- |
| 95 | ++ |
| 96 | +.Example output |
| 97 | ++ |
| 98 | +[source, terminal] |
| 99 | +---- |
| 100 | +secret/aws-efs-cloud-credentials created |
| 101 | +---- |
0 commit comments