Secret "ebs-cloud-credentials" Not Found on ROSA
Environment
- Red Hat OpenShift on AWS (ROSA)
- 4
Issue
- Persistent volumes are not being provisioned with the event:
MountVolume.SetUp failed for volume "aws-credentials" : secret "ebs-cloud-credentials" not found - The
aws-ebs-csi-controllersare stuck in aContainerCreatingstatus. - Logs indicate that the "ebs-cloud-credentials" secret is missing.
Resolution
-
Retrieve the Role ARN:
Use therosaCLI tool to fetch the Role ARN for the EBS CSI driver:ROLE_ARN=$(rosa describe cluster -c YOUR_CLUSTER_ID -o json | jq -r '.aws.sts.operator_iam_roles[] | select(.name == "ebs-cloud-credentials") | .role_arn') -
Prepare the Credentials:
Create the unencoded credentials content:CREDENTIALS_TXT=$(cat <<EOF [default] role_arn = ${ROLE_ARN} web_identity_token_file = /var/run/secrets/openshift/serviceaccount/token sts_regional_endpoints = regional EOF ) -
Base64 Encode the Credentials:
Ensure consistent encoding across platforms:OS=$(uname) BASE64_OPT="" if [ "${OS}" == "Linux" ]; then BASE64_OPT="-w0" fi ENCODED_CREDENTIALS=$(printf "%s" "${CREDENTIALS_TXT}" | base64 ${BASE64_OPT}) ENCODED_ROLE_ARN=$(printf "%s" "${ROLE_ARN}" | base64 ${BASE64_OPT})
Note: The
-w0option is specific to the GNU version of base64 (AKA Linux). On macOS, the equivalent option is-b, but it's not needed because base64 on macOS does not wrap lines by default.
-
Recreate the Secret Using the Encoded Values:
Create a YAML manifest for the secret:cat <<EOF > ebs-cloud-credentials-secret.yaml apiVersion: v1 kind: Secret metadata: name: ebs-cloud-credentials namespace: openshift-cluster-csi-drivers type: Opaque data: credentials: ${ENCODED_CREDENTIALS} role_arn: ${ENCODED_ROLE_ARN} EOFApply the secret using the
ocCLI tool:oc apply -f ebs-cloud-credentials-secret.yaml
Root Cause
The ebs-cloud-credentials secret, which contains the AWS Role ARN needed by the EBS CSI driver, was deleted. This secret is not automatically reconciled and is typically only created during cluster installation.
This was usually caused by the namespace openshift-cluster-csi-drivers has been accidentally deleted.
Diagnostic Steps
-
Check if the Namespace was Recently Deleted and Recreated:
Review the timestamp ofopenshift-cluster-csi-driversnamespace:oc get namespace openshift-cluster-csi-drivers -
Verify if the Secret is Missing:
Check for the presence of theebs-cloud-credentialsSecret:oc get secret ebs-cloud-credentials -n openshift-cluster-csi-driversIf the Secret is missing, you will receive a "not found" error.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments