Inspecting and Extracting Kubernetes Kubeconfig Data
Scenario
You are working on the host dev-machine and are provided with a kubeconfig file located at /opt/labs/2/admin-kubeconfig.
The kubeconfig contains multiple contexts and users, all of which authenticate using a client certificate.
Perform the task on the dev-machine using the root user.
Tasks
- Write all kubeconfig context names into
/opt/labs/2/context-list, one per line. - Write the name of the current context into
/opt/labs/2/active-context. - Extract the base64-encoded client certificate of user
user-account-1042, decode it, and write the decoded certificate to/opt/labs/2/client-cert.
Test Cases
Level up your Server Side game — Join 20,000 engineers who receive insightful learning materials straight to their inbox