KCNA · Question #40
Which command provides information about the field replicas within the spec resource of a deployment object?
The correct answer is B. kubectl explain deployment.spec.replicas. The kubectl explain command is used to provide detailed information and schema documentation for specific fields within Kubernetes resources, such as replicas in a Deployment's spec.
Question
Which command provides information about the field replicas within the spec resource of a deployment object?
Options
- Akubectl get deployment.spec.replicas
- Bkubectl explain deployment.spec.replicas
- Ckubectl describe deployment.spec.replicas
- Dkubectl explain deployment --spec.replicas
How the community answered
(17 responses)- B94% (16)
- D6% (1)
Why each option
The `kubectl explain` command is used to provide detailed information and schema documentation for specific fields within Kubernetes resources, such as `replicas` in a Deployment's `spec`.
`kubectl get` is used to retrieve actual instances of resources, not to provide schema documentation for specific fields.
`kubectl explain deployment.spec.replicas` is the correct command to retrieve detailed documentation on the `replicas` field, which is nested under the `spec` of a `Deployment` resource. This command is specifically designed for exploring the schema and purpose of fields within Kubernetes API objects.
`kubectl describe` provides detailed runtime information about a specific resource instance, not the schema documentation for a field.
The `kubectl explain` command uses dot notation (`.`) for nested fields, so `deployment --spec.replicas` is syntactically incorrect; it should be `deployment.spec.replicas`.
Concept tested: Kubernetes resource field documentation (kubectl explain)
Source: https://kubernetes.io/docs/reference/kubectl/cheatsheet/#exploring-resources
Topics
Community Discussion
No community discussion yet for this question.