5.4.3. Updating the global cluster pull secret
To add new registries or update authentication for your OpenShift Container Platform cluster, you can update the global pull secret by appending new credentials to the additional-pull-secret. To do this, you can use the oc set data secret/additional-pull-secret -n kube-system command. Hypershift manages the new credential propagation among the HostedCluster nodes.
The global pull secret is a HostedControlPlane feature only and is not an OCP standalone feature.
To transfer your cluster to another owner, you must initiate the transfer in OpenShift Cluster Manager and then update the pull secret on the cluster. Updating a cluster’s pull secret without initiating the transfer in OpenShift Cluster Manager causes the cluster to stop reporting Telemetry metrics in OpenShift Cluster Manager.
For more information, see Transferring cluster ownership under Additional resources in the Red Hat OpenShift Cluster Manager documentation.
Prerequisites
-
You have access to the cluster as a user with the
cluster-adminrole.
Procedure
Optional: To append a new pull secret to the existing pull secret:
Download the pull secret by entering the following command:
$ oc get secret/pull-secret -n openshift-config --template='{{index .data ".dockerconfigjson" | base64decode}}' > <pull_secret_location>where:
<pull_secret_location>- Specifies the path to the pull secret file.
Add the new pull secret by entering the following command:
$ oc registry login --registry="<registry>" \ --auth-basic="<username>:<password>" \ --to=<pull_secret_location>where:
<registry>-
Specifies the new registry. You can include many repositories within the same registry, for example:
--registry="<registry/my-namespace/my-repository>. <username>:<password>- Specifies the credentials of the new registry.
<pull_secret_location>- Specifies the path to the pull secret file.
Update the global pull secret for your cluster by entering the following command. Note that this update rolls out to all nodes, which can take some time depending on the size of your cluster.
$ oc set data secret/pull-secret -n openshift-config \ --from-file=.dockerconfigjson=<pull_secret_location>where:
<pull_secret_location>- Specifies the path to the new pull secret file.
This merges your additional pull secret with the original HostedCluster pull secret, making it available to all nodes in the cluster.
Optional: Modify the additional pull secret added by entering the following command:
$ oc edit secret additional-pull-secret -n kube-systemThe secret must contain a valid DockerConfigJSON format.
Example pull secret
apiVersion: v1 kind: Secret metadata: name: additional-pull-secret namespace: kube-system type: kubernetes.io/dockerconfigjson data: .dockerconfigjson: <base64-encoded-docker-config-json>This results in the following states of the each pull secret:
- Original: immutable
- Additional: mutable
- Global: final state of both the original and additional pull secrets
Optional: Delete the additional pull secret added by entering the following command:
$ oc delete secret additional-pull-secret -n kube-systemThis triggers the automatic cleanup process across your nodes.