Why does PVC or pod creation fail due to not finding the Kubernetes secret?

Virtual Private Cloud Classic infrastructure

PVC or pod creation fails because the Kubernetes secret for IBM Cloud Object Storage is not found or incorrectly referenced.

When you create your PVC or deploy a pod that mounts the PVC, the creation or deployment fails.

Example error message for a PVC creation failure:

can't get credentials: can't get secret tsecret-key: secrets "secret-key" not found

Example error message for a pod creation failure:

persistentvolumeclaim "pvc-3" not found (repeated 3 times)

The Kubernetes secret that you created is not referenced correctly in your deployment YAML file or is not set to the ibm/ibmc-s3fs type.

Resolving the issue

This task requires the Writer or Manager IBM Cloud IAM service access role for all projects.

  1. List the secrets in your cluster and review the secret type. The secret must show ibm/ibmc-s3fs as the Type.

    oc get secrets --all-namespaces
    
  2. If your secret does not show ibm/ibmc-s3fs as the Type, re-create your secret.

  3. Check your YAML configuration file for your PVC and pod to verify that you used the correct secret name.

  4. Verify that the secret exists in the same namespace as your PVC or pod.

    oc get secret <secret_name> -n <namespace>
    
  5. After correcting the secret reference, redeploy your PVC or pod and verify it mounts successfully.

    oc get pvc
    oc get pods