KCNA ยท Cluster administration and scheduling
kubeconfig, contexts and cluster access
kubeconfig structure (clusters, users, contexts), switching contexts, how clients authenticate to the API server.
Key points
- A kubeconfig file lists clusters (API server address and CA), users (credentials such as client certificates, tokens or credential plugins) and contexts.
- A context pairs one cluster, one user and a namespace; current-context says which one kubectl uses.
- The default file is $HOME/.kube/config, and the KUBECONFIG variable can point to several files that are merged.
Source: https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/
Practice questions
Which three lists make up the body of a kubeconfig file?
- nodes, pods, services
- clusters, users, contexts
- roles, bindings, accounts
- masters, workers, proxies
Show answer
Answer: B. clusters, users, contexts
Clusters hold server endpoints, users hold credentials, contexts tie them together. Nodes, Pods and Services are cluster objects, not kubeconfig sections.
A context in kubeconfig combines which elements?
- A cluster entry
- A node name
- A user entry
- A namespace
- A container image
Show answer
Answer: A. A cluster entry, C. A user entry, D. A namespace
A context is a triple of cluster, user and namespace. Nodes and container images are not part of it.
A context stores the client certificate or token itself.
Show answer
Answer: False
False. Credentials live in the users section; a context only references a user by name, along with a cluster and namespace.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
