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

Study for the Kubernetes Certified Network Administrator Exam. Our test offers comprehensive flashcards, multiple-choice questions, and detailed explanations. Be confident for your exam!

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