Kubernetes and Cloud Native Associate (KCNA)Kubernetes FundamentalsEasy
A cluster operator needs to check the current version of the Kubernetes client and server components to ensure compatibility and identify any potential upgrade issues. Which `kubectl` command would provide this information?
- A`kubectl api-resources`
- B`kubectl cluster-info`
- C`kubectl get nodes`
- D`kubectl version`
Show answer & explanationAnswer & explanation
Correct answer: D. `kubectl version`
The `kubectl version` command displays the client (kubectl) and server (kube-apiserver) versions, along with their respective Git commit hashes and build dates, which is crucial for verifying compatibility.
Why the other options are wrong
- A. `kubectl api-resources` lists the API resources available in the cluster, not the client/server versions.
- B. `kubectl cluster-info` displays endpoints for the master and services, but not detailed version information.
- C. `kubectl get nodes` shows information about the cluster's worker nodes, not the client/server versions.
kubectl version
A `kubectl` command used to display the version information of both the `kubectl` client and the Kubernetes API server.
- Shows client and server versions.
- Includes Git commit and build date.
- Essential for compatibility checks and troubleshooting.
Memory trick: To know the versions, just ask for the 'version'!