How to modify kubeconfig for system:admin user after adding API certificate in OpenShift 4?

Solution Verified - Updated -

Issue

  • kubeconfig file is not missing but it is necessary to modify it after adding the API server certificate.
  • After adding the API server certificate by the steps introduced in the document, it is impossible to access the cluster with the original kubeconfig file for the following error:
$ oc login -u system:admin --kubeconfig=<install directory>/auth/kubeconfig
error: username system:admin is invalid for basic auth
  • I want to keep using the original kubeconfig file as it has a 10-year expiration, yet the re-created kubeconfig file has only no more than 14-months expiration.

Environment

  • Red Hat OpenShift Container Platform (RHOCP)

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content