Kubernetes and Cloud Native Associate (KCNA)Kubernetes FundamentalsMedium
A cluster operator needs to check the version of both the Kubernetes client (kubectl) and the server components (kube-apiserver, kubelet). Which `kubectl` command should they use to retrieve this information?
- A`kubectl get nodes -o wide`
- B`kubectl cluster-info`
- C`kubectl version`
- D`kubectl describe cluster`
Show answer & explanationAnswer & explanation
Correct answer: C. `kubectl version`
The `kubectl version` command outputs the client version (kubectl) and connects to the Kubernetes API server to retrieve and display the server components' versions, including kube-apiserver and kubelet.
Why the other options are wrong
- A. This command shows node details, not client/server versions.
- B. `kubectl cluster-info` shows endpoints of control plane services, not versions.
- D. `kubectl describe` is used for detailed information about a specific resource, and 'cluster' is not a standard describable resource in this context.
`kubectl version`
The `kubectl version` command is used to display the version of the Kubernetes client (`kubectl`) and the Kubernetes server components.
- Shows client (kubectl) version.
- Shows server (kube-apiserver, kubelet, etc.) versions.
- Useful for debugging compatibility issues.
Memory trick: To know the 'Version', just ask for 'Version'.