How to recover admin kubeconfig from .openshift_install_state.json
Environment
- OpenShift 4.x
Issue
- Installation directory is available but admin kubeconfig generated by installation has been corrupted or is lost.
- I need to recover admin kubeconfig generated during installation.
Resolution
It is required to have jq installed for this solution to work.
It is possible to extract it from install state file .openshift_install_state.json by running this command on the installation directory:
$ cat .openshift_install_state.json | jq -r '.["*kubeconfig.AdminClient"].File.Data' | base64 -d
In case of Agent Based Installation, below command needs to be used.
$ cat .openshift_install_state.json | jq -r '.["*kubeconfig.AgentAdminClient"].File.Data' | base64 -d
Root Cause
Install state file stores many assets used by openshift-install, including the admin kubeconfig it generates.
SBR
Product(s)
Category
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.