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

Enhance your knowledge for the Kubernetes Certified Network Administrator Test. Utilize flashcards and multiple choice questions with detailed explanations. Prepare effectively for your KCNA 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