SIMULATION
Task SIMULATION 10
Kubeconfig Management -- Set Context in Kubeconfig
Answer : A
Step 1: Verify the cluster name, namespace, and user name that should be referenced.
The lab uses cluster api-ocp4-example-com:6443, namespace audit-ns, and user audit-sa.
Step 2: Run the command:
oc config set-context audit --cluster api-ocp4-example-com:6443 --namespace audit-ns --user audit-sa --kubeconfig audit.config
Step 3: Confirm context creation.
The lab output shows:
Context 'audit' created.
Detailed explanation:
A kubeconfig context ties together three things: a cluster endpoint, a user identity, and optionally a default namespace. This Task creates a context named audit in the file audit.config. Contexts are useful because they simplify repeated administration by letting the user switch between prepared working environments instead of re-entering cluster and namespace details each time. The namespace portion is especially helpful for project-scoped operations, because commands run under that context default to the chosen namespace. Accuracy matters here: if the user name in the context does not match the credentials entry or the cluster name does not exist in the kubeconfig, the context will not function as intended.
============