What happens when applying a manifest with kubectl apply if the resource already exists?

Prepare for the Kubernetes Certified Network Administrator (KCNA) exam with our detailed tests. Use flashcards and multiple choice questions, complete with hints and explanations, to enhance your learning experience. Get exam-ready today!

Multiple Choice

What happens when applying a manifest with kubectl apply if the resource already exists?

Explanation:
When you apply a manifest to an existing resource, kubectl updates the live object in place to match what’s described in the manifest. It reconciles the current state with the desired state by patching the fields that differ, while keeping the resource’s identity (name, namespace, UID) intact. It does not destroy or recreate the resource, so the update happens without replacing the object. If you try to change a field that is immutable after creation, the apply can fail for that field and you’d need to delete and recreate the resource to change it. If there are no differences, apply essentially does nothing.

When you apply a manifest to an existing resource, kubectl updates the live object in place to match what’s described in the manifest. It reconciles the current state with the desired state by patching the fields that differ, while keeping the resource’s identity (name, namespace, UID) intact. It does not destroy or recreate the resource, so the update happens without replacing the object. If you try to change a field that is immutable after creation, the apply can fail for that field and you’d need to delete and recreate the resource to change it. If there are no differences, apply essentially does nothing.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy