Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 10. Changing the cloud provider credentials configuration
For supported configurations, you can change how OpenShift Container Platform authenticates with your cloud provider.
To determine which cloud credentials strategy your cluster uses, see Determining the Cloud Credential Operator mode.
10.1. Rotating or removing cloud provider credentials Link kopierenLink in die Zwischenablage kopiert!
After installing OpenShift Container Platform, some organizations require the rotation or removal of the cloud provider credentials that were used during the initial installation.
To allow the cluster to use the new credentials, you must update the secrets that the Cloud Credential Operator (CCO) uses to manage cloud provider credentials.
10.1.1. Rotating cloud provider credentials with the Cloud Credential Operator utility Link kopierenLink in die Zwischenablage kopiert!
The Cloud Credential Operator (CCO) utility ccoctl supports updating secrets for clusters installed on IBM Cloud®.
10.1.1.1. Rotating API keys Link kopierenLink in die Zwischenablage kopiert!
You can rotate API keys for your existing service IDs and update the corresponding secrets.
Prerequisites
-
You have configured the
ccoctlbinary. - You have existing service IDs in a live OpenShift Container Platform cluster installed.
Procedure
Use the
ccoctlutility to rotate your API keys for the service IDs and update the secrets:ccoctl <provider_name> refresh-keys \ --kubeconfig <openshift_kubeconfig_file> \ --credentials-requests-dir <path_to_credential_requests_directory> \ --name <name>$ ccoctl <provider_name> refresh-keys \1 --kubeconfig <openshift_kubeconfig_file> \2 --credentials-requests-dir <path_to_credential_requests_directory> \3 --name <name>4 Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIf your cluster uses Technology Preview features that are enabled by the
TechPreviewNoUpgradefeature set, you must include the--enable-tech-previewparameter.
10.1.2. Rotating cloud provider credentials manually Link kopierenLink in die Zwischenablage kopiert!
If your cloud provider credentials are changed for any reason, you must manually update the secret that the Cloud Credential Operator (CCO) uses to manage cloud provider credentials.
The process for rotating cloud credentials depends on the mode that the CCO is configured to use. After you rotate credentials for a cluster that is using mint mode, you must manually remove the component credentials that were created by the removed credential.
Prerequisites
Your cluster is installed on a platform that supports rotating cloud credentials manually with the CCO mode that you are using:
- For mint mode, Amazon Web Services (AWS) and Google Cloud Platform (GCP) are supported.
- For passthrough mode, Amazon Web Services (AWS), Microsoft Azure, Google Cloud Platform (GCP), Red Hat OpenStack Platform (RHOSP), and VMware vSphere are supported.
- You have changed the credentials that are used to interface with your cloud provider.
- The new credentials have sufficient permissions for the mode CCO is configured to use in your cluster.
Procedure
-
In the Administrator perspective of the web console, navigate to Workloads
Secrets. In the table on the Secrets page, find the root secret for your cloud provider.
Expand Platform Secret name AWS
aws-credsAzure
azure-credentialsGCP
gcp-credentialsRHOSP
openstack-credentialsVMware vSphere
vsphere-creds-
Click the Options menu
in the same row as the secret and select Edit Secret.
- Record the contents of the Value field or fields. You can use this information to verify that the value is different after updating the credentials.
- Update the text in the Value field or fields with the new authentication information for your cloud provider, and then click Save.
If you are updating the credentials for a vSphere cluster that does not have the vSphere CSI Driver Operator enabled, you must force a rollout of the Kubernetes controller manager to apply the updated credentials.
NoteIf the vSphere CSI Driver Operator is enabled, this step is not required.
To apply the updated vSphere credentials, log in to the OpenShift Container Platform CLI as a user with the
cluster-adminrole and run the following command:oc patch kubecontrollermanager cluster \ -p='{"spec": {"forceRedeploymentReason": "recovery-'"$( date )"'"}}' \ --type=merge$ oc patch kubecontrollermanager cluster \ -p='{"spec": {"forceRedeploymentReason": "recovery-'"$( date )"'"}}' \ --type=mergeCopy to Clipboard Copied! Toggle word wrap Toggle overflow While the credentials are rolling out, the status of the Kubernetes Controller Manager Operator reports
Progressing=true. To view the status, run the following command:oc get co kube-controller-manager
$ oc get co kube-controller-managerCopy to Clipboard Copied! Toggle word wrap Toggle overflow If the CCO for your cluster is configured to use mint mode, delete each component secret that is referenced by the individual
CredentialsRequestobjects.-
Log in to the OpenShift Container Platform CLI as a user with the
cluster-adminrole. Get the names and namespaces of all referenced component secrets:
oc -n openshift-cloud-credential-operator get CredentialsRequest \ -o json | jq -r '.items[] | select (.spec.providerSpec.kind=="<provider_spec>") | .spec.secretRef'
$ oc -n openshift-cloud-credential-operator get CredentialsRequest \ -o json | jq -r '.items[] | select (.spec.providerSpec.kind=="<provider_spec>") | .spec.secretRef'Copy to Clipboard Copied! Toggle word wrap Toggle overflow where
<provider_spec>is the corresponding value for your cloud provider:-
AWS:
AWSProviderSpec -
GCP:
GCPProviderSpec
Partial example output for AWS
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
AWS:
Delete each of the referenced component secrets:
oc delete secret <secret_name> \ -n <secret_namespace>
$ oc delete secret <secret_name> \1 -n <secret_namespace>2 Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example deletion of an AWS secret
oc delete secret ebs-cloud-credentials -n openshift-cluster-csi-drivers
$ oc delete secret ebs-cloud-credentials -n openshift-cluster-csi-driversCopy to Clipboard Copied! Toggle word wrap Toggle overflow You do not need to manually delete the credentials from your provider console. Deleting the referenced component secrets will cause the CCO to delete the existing credentials from the platform and create new ones.
-
Log in to the OpenShift Container Platform CLI as a user with the
Verification
To verify that the credentials have changed:
-
In the Administrator perspective of the web console, navigate to Workloads
Secrets. - Verify that the contents of the Value field or fields have changed.
10.1.3. Removing cloud provider credentials Link kopierenLink in die Zwischenablage kopiert!
For clusters that use the Cloud Credential Operator (CCO) in mint mode, the administrator-level credential is stored in the kube-system namespace. The CCO uses the admin credential to process the CredentialsRequest objects in the cluster and create users for components with limited permissions.
After installing an OpenShift Container Platform cluster with the CCO in mint mode, you can remove the administrator-level credential secret from the kube-system namespace in the cluster. The CCO only requires the administrator-level credential during changes that require reconciling new or modified CredentialsRequest custom resources, such as minor cluster version updates.
Before performing a minor version cluster update (for example, updating from OpenShift Container Platform 4.16 to 4.17), you must reinstate the credential secret with the administrator-level credential. If the credential is not present, the update might be blocked.
Prerequisites
- Your cluster is installed on a platform that supports removing cloud credentials from the CCO. Supported platforms are AWS and GCP.
Procedure
-
In the Administrator perspective of the web console, navigate to Workloads
Secrets. In the table on the Secrets page, find the root secret for your cloud provider.
Expand Platform Secret name AWS
aws-credsGCP
gcp-credentials-
Click the Options menu
in the same row as the secret and select Delete Secret.
10.2. Enabling token-based authentication Link kopierenLink in die Zwischenablage kopiert!
After installing an Microsoft Azure OpenShift Container Platform cluster, you can enable Microsoft Entra Workload ID to use short-term credentials.
10.2.1. Configuring the Cloud Credential Operator utility Link kopierenLink in die Zwischenablage kopiert!
To configure an existing cluster to create and manage cloud credentials from outside of the cluster, extract and prepare the Cloud Credential Operator utility (ccoctl) binary.
The ccoctl utility is a Linux binary that must run in a Linux environment.
Prerequisites
- You have access to an OpenShift Container Platform account with cluster administrator access.
-
You have installed the OpenShift CLI (
oc).
Procedure
Set a variable for the OpenShift Container Platform release image by running the following command:
RELEASE_IMAGE=$(oc get clusterversion -o jsonpath={..desired.image})$ RELEASE_IMAGE=$(oc get clusterversion -o jsonpath={..desired.image})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Obtain the CCO container image from the OpenShift Container Platform release image by running the following command:
CCO_IMAGE=$(oc adm release info --image-for='cloud-credential-operator' $RELEASE_IMAGE -a ~/.pull-secret)
$ CCO_IMAGE=$(oc adm release info --image-for='cloud-credential-operator' $RELEASE_IMAGE -a ~/.pull-secret)Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteEnsure that the architecture of the
$RELEASE_IMAGEmatches the architecture of the environment in which you will use theccoctltool.Extract the
ccoctlbinary from the CCO container image within the OpenShift Container Platform release image by running the following command:oc image extract $CCO_IMAGE \ --file="/usr/bin/ccoctl.<rhel_version>" \ -a ~/.pull-secret
$ oc image extract $CCO_IMAGE \ --file="/usr/bin/ccoctl.<rhel_version>" \1 -a ~/.pull-secretCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- For
<rhel_version>, specify the value that corresponds to the version of Red Hat Enterprise Linux (RHEL) that the host uses. If no value is specified,ccoctl.rhel8is used by default. The following values are valid:-
rhel8: Specify this value for hosts that use RHEL 8. -
rhel9: Specify this value for hosts that use RHEL 9.
-
Change the permissions to make
ccoctlexecutable by running the following command:chmod 775 ccoctl.<rhel_version>
$ chmod 775 ccoctl.<rhel_version>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
To verify that
ccoctlis ready to use, display the help file. Use a relative file name when you run the command, for example:./ccoctl.rhel9
$ ./ccoctl.rhel9Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.2.2. Enabling Microsoft Entra Workload ID on an existing cluster Link kopierenLink in die Zwischenablage kopiert!
If you did not configure your Microsoft Azure OpenShift Container Platform cluster to use Microsoft Entra Workload ID during installation, you can enable this authentication method on an existing cluster.
The process to enable Workload ID on an existing cluster is disruptive and takes a significant amount of time. Before proceeding, observe the following considerations:
- Read the following steps and ensure that you understand and accept the time requirement. The exact time requirement varies depending on the individual cluster, but it is likely to require at least one hour.
- During this process, you must refresh all service accounts and restart all pods on the cluster. These actions are disruptive to workloads. To mitigate this impact, you can temporarily halt these services and then redeploy them when the cluster is ready.
- After starting this process, do not attempt to update the cluster until it is complete. If an update is triggered, the process to enable Workload ID on an existing cluster fails.
Prerequisites
- You have installed an OpenShift Container Platform cluster on Microsoft Azure.
-
You have access to the cluster using an account with
cluster-adminpermissions. -
You have installed the OpenShift CLI (
oc). -
You have extracted and prepared the Cloud Credential Operator utility (
ccoctl) binary. -
You have access to your Azure account by using the Azure CLI (
az).
Procedure
-
Create an output directory for the manifests that the
ccoctlutility generates. This procedure uses./output_diras an example. Extract the service account public signing key for the cluster to the output directory by running the following command:
oc get configmap \ --namespace openshift-kube-apiserver bound-sa-token-signing-certs \ --output 'go-template={{index .data "service-account-001.pub"}}' > ./output_dir/serviceaccount-signer.public$ oc get configmap \ --namespace openshift-kube-apiserver bound-sa-token-signing-certs \ --output 'go-template={{index .data "service-account-001.pub"}}' > ./output_dir/serviceaccount-signer.public1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- This procedure uses a file named
serviceaccount-signer.publicas an example.
Use the extracted service account public signing key to create an OpenID Connect (OIDC) issuer and Azure blob storage container with OIDC configuration files by running the following command:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The value of the
nameparameter is used to create an Azure resource group. To use an existing Azure resource group instead of creating a new one, specify the--oidc-resource-group-nameargument with the existing group name as its value. - 2
- Specify the region of the existing cluster.
- 3
- Specify the subscription ID of the existing cluster.
- 4
- Specify the file that contains the service account public signing key for the cluster.
Verify that the configuration file for the Azure pod identity webhook was created by running the following command:
ll ./output_dir/manifests
$ ll ./output_dir/manifestsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
total 8 -rw-------. 1 cloud-user cloud-user 193 May 22 02:29 azure-ad-pod-identity-webhook-config.yaml -rw-------. 1 cloud-user cloud-user 165 May 22 02:29 cluster-authentication-02-config.yaml
total 8 -rw-------. 1 cloud-user cloud-user 193 May 22 02:29 azure-ad-pod-identity-webhook-config.yaml1 -rw-------. 1 cloud-user cloud-user 165 May 22 02:29 cluster-authentication-02-config.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The file
azure-ad-pod-identity-webhook-config.yamlcontains the Azure pod identity webhook configuration.
Set an
OIDC_ISSUER_URLvariable with the OIDC issuer URL from the generated manifests in the output directory by running the following command:OIDC_ISSUER_URL=`awk '/serviceAccountIssuer/ { print $2 }' ./output_dir/manifests/cluster-authentication-02-config.yaml`$ OIDC_ISSUER_URL=`awk '/serviceAccountIssuer/ { print $2 }' ./output_dir/manifests/cluster-authentication-02-config.yaml`Copy to Clipboard Copied! Toggle word wrap Toggle overflow Update the
spec.serviceAccountIssuerparameter of the clusterauthenticationconfiguration by running the following command:oc patch authentication cluster \ --type=merge \ -p "{\"spec\":{\"serviceAccountIssuer\":\"${OIDC_ISSUER_URL}\"}}"$ oc patch authentication cluster \ --type=merge \ -p "{\"spec\":{\"serviceAccountIssuer\":\"${OIDC_ISSUER_URL}\"}}"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Monitor the configuration update progress by running the following command:
oc adm wait-for-stable-cluster
$ oc adm wait-for-stable-clusterCopy to Clipboard Copied! Toggle word wrap Toggle overflow This process might take 15 minutes or longer. The following output indicates that the process is complete:
All clusteroperators are stable
All clusteroperators are stableCopy to Clipboard Copied! Toggle word wrap Toggle overflow Restart all of the pods in the cluster by running the following command:
oc adm reboot-machine-config-pool mcp/worker mcp/master
$ oc adm reboot-machine-config-pool mcp/worker mcp/masterCopy to Clipboard Copied! Toggle word wrap Toggle overflow Restarting a pod updates the
serviceAccountIssuerfield and refreshes the service account public signing key.Monitor the restart and update process by running the following command:
oc adm wait-for-node-reboot nodes --all
$ oc adm wait-for-node-reboot nodes --allCopy to Clipboard Copied! Toggle word wrap Toggle overflow This process might take 15 minutes or longer. The following output indicates that the process is complete:
All nodes rebooted
All nodes rebootedCopy to Clipboard Copied! Toggle word wrap Toggle overflow Update the Cloud Credential Operator
spec.credentialsModeparameter toManualby running the following command:oc patch cloudcredential cluster \ --type=merge \ --patch '{"spec":{"credentialsMode":"Manual"}}'$ oc patch cloudcredential cluster \ --type=merge \ --patch '{"spec":{"credentialsMode":"Manual"}}'Copy to Clipboard Copied! Toggle word wrap Toggle overflow Extract the list of
CredentialsRequestobjects from the OpenShift Container Platform release image by running the following command:oc adm release extract \ --credentials-requests \ --included \ --to <path_to_directory_for_credentials_requests> \ --registry-config ~/.pull-secret
$ oc adm release extract \ --credentials-requests \ --included \ --to <path_to_directory_for_credentials_requests> \ --registry-config ~/.pull-secretCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThis command might take a few moments to run.
Set an
AZURE_INSTALL_RGvariable with the Azure resource group name by running the following command:AZURE_INSTALL_RG=`oc get infrastructure cluster -o jsonpath --template '{ .status.platformStatus.azure.resourceGroupName }'`$ AZURE_INSTALL_RG=`oc get infrastructure cluster -o jsonpath --template '{ .status.platformStatus.azure.resourceGroupName }'`Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the
ccoctlutility to create managed identities for allCredentialsRequestobjects by running the following command:NoteThe following command does not show all available options. For a complete list of options, including those that might be necessary for your specific use case, run
$ ccoctl azure create-managed-identities --help.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the Azure pod identity webhook configuration for Workload ID by running the following command:
oc apply -f ./output_dir/manifests/azure-ad-pod-identity-webhook-config.yaml
$ oc apply -f ./output_dir/manifests/azure-ad-pod-identity-webhook-config.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the secrets generated by the
ccoctlutility by running the following command:find ./output_dir/manifests -iname "openshift*yaml" -print0 | xargs -I {} -0 -t oc replace -f {}$ find ./output_dir/manifests -iname "openshift*yaml" -print0 | xargs -I {} -0 -t oc replace -f {}Copy to Clipboard Copied! Toggle word wrap Toggle overflow This process might take several minutes.
Restart all of the pods in the cluster by running the following command:
oc adm reboot-machine-config-pool mcp/worker mcp/master
$ oc adm reboot-machine-config-pool mcp/worker mcp/masterCopy to Clipboard Copied! Toggle word wrap Toggle overflow Restarting a pod updates the
serviceAccountIssuerfield and refreshes the service account public signing key.Monitor the restart and update process by running the following command:
oc adm wait-for-node-reboot nodes --all
$ oc adm wait-for-node-reboot nodes --allCopy to Clipboard Copied! Toggle word wrap Toggle overflow This process might take 15 minutes or longer. The following output indicates that the process is complete:
All nodes rebooted
All nodes rebootedCopy to Clipboard Copied! Toggle word wrap Toggle overflow Monitor the configuration update progress by running the following command:
oc adm wait-for-stable-cluster
$ oc adm wait-for-stable-clusterCopy to Clipboard Copied! Toggle word wrap Toggle overflow This process might take 15 minutes or longer. The following output indicates that the process is complete:
All clusteroperators are stable
All clusteroperators are stableCopy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Remove the Azure root credentials secret by running the following command:
oc delete secret -n kube-system azure-credentials
$ oc delete secret -n kube-system azure-credentialsCopy to Clipboard Copied! Toggle word wrap Toggle overflow
10.2.3. Verifying that a cluster uses short-term credentials Link kopierenLink in die Zwischenablage kopiert!
You can verify that a cluster uses short-term security credentials for individual components by checking the Cloud Credential Operator (CCO) configuration and other values in the cluster.
Prerequisites
-
You deployed an OpenShift Container Platform cluster using the Cloud Credential Operator utility (
ccoctl) to implement short-term credentials. -
You installed the OpenShift CLI (
oc). -
You are logged in as a user with
cluster-adminprivileges.
Procedure
Verify that the CCO is configured to operate in manual mode by running the following command:
oc get cloudcredentials cluster \ -o=jsonpath={.spec.credentialsMode}$ oc get cloudcredentials cluster \ -o=jsonpath={.spec.credentialsMode}Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following output confirms that the CCO is operating in manual mode:
Example output
Manual
ManualCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the cluster does not have
rootcredentials by running the following command:oc get secrets \ -n kube-system <secret_name>
$ oc get secrets \ -n kube-system <secret_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow where
<secret_name>is the name of the root secret for your cloud provider.Expand Platform Secret name Amazon Web Services (AWS)
aws-credsMicrosoft Azure
azure-credentialsGoogle Cloud
gcp-credentialsAn error confirms that the root secret is not present on the cluster.
Example output for an AWS cluster
Error from server (NotFound): secrets "aws-creds" not found
Error from server (NotFound): secrets "aws-creds" not foundCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the components are using short-term security credentials for individual components by running the following command:
oc get authentication cluster \ -o jsonpath \ --template='{ .spec.serviceAccountIssuer }'$ oc get authentication cluster \ -o jsonpath \ --template='{ .spec.serviceAccountIssuer }'Copy to Clipboard Copied! Toggle word wrap Toggle overflow This command displays the value of the
.spec.serviceAccountIssuerparameter in the clusterAuthenticationobject. An output of a URL that is associated with your cloud provider indicates that the cluster is using manual mode with short-term credentials that are created and managed from outside of the cluster.Azure clusters: Verify that the components are assuming the Azure client ID that is specified in the secret manifests by running the following command:
oc get secrets \ -n openshift-image-registry installer-cloud-credentials \ -o jsonpath='{.data}'$ oc get secrets \ -n openshift-image-registry installer-cloud-credentials \ -o jsonpath='{.data}'Copy to Clipboard Copied! Toggle word wrap Toggle overflow An output that contains the
azure_client_idandazure_federated_token_filefelids confirms that the components are assuming the Azure client ID.Azure clusters: Verify that the pod identity webhook is running by running the following command:
oc get pods \ -n openshift-cloud-credential-operator
$ oc get pods \ -n openshift-cloud-credential-operatorCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
NAME READY STATUS RESTARTS AGE cloud-credential-operator-59cf744f78-r8pbq 2/2 Running 2 71m pod-identity-webhook-548f977b4c-859lz 1/1 Running 1 70m
NAME READY STATUS RESTARTS AGE cloud-credential-operator-59cf744f78-r8pbq 2/2 Running 2 71m pod-identity-webhook-548f977b4c-859lz 1/1 Running 1 70mCopy to Clipboard Copied! Toggle word wrap Toggle overflow