Which command applies a configuration file to create or update resources in a declarative manner?

Prepare for the KCNA Certification Test. Study with flashcards, multiple-choice questions, and detailed explanations to enhance your understanding of Kubernetes Cloud Native concepts. Ace your exam!

Multiple Choice

Which command applies a configuration file to create or update resources in a declarative manner?

Explanation:
Declarative configuration management in Kubernetes is about describing the desired state in a manifest and having the cluster reconcile to match that state. The command kubectl apply -f <config_file.yaml> does exactly that: it reads the configuration file, creates resources that don’t exist, and updates existing ones to align with what’s specified. It performs a merge so only the fields included in the file are adjusted, while other fields remain intact, and it tracks what was last applied to support safe, iterative updates. This makes the operation idempotent—reapplying the same file brings the cluster to the same state. Other options differ in behavior: patch updates only specified fields and isn’t designed for applying a full declarative configuration file; replace overwrites the entire resource (potentially discarding unspecified fields); create only creates new resources and will fail if they already exist.

Declarative configuration management in Kubernetes is about describing the desired state in a manifest and having the cluster reconcile to match that state. The command kubectl apply -f <config_file.yaml> does exactly that: it reads the configuration file, creates resources that don’t exist, and updates existing ones to align with what’s specified. It performs a merge so only the fields included in the file are adjusted, while other fields remain intact, and it tracks what was last applied to support safe, iterative updates. This makes the operation idempotent—reapplying the same file brings the cluster to the same state.

Other options differ in behavior: patch updates only specified fields and isn’t designed for applying a full declarative configuration file; replace overwrites the entire resource (potentially discarding unspecified fields); create only creates new resources and will fail if they already exist.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy