Difference between kubectl apply and kubectl create?

541    Asked by KaranTrivedi in Data Science , Asked on Jul 15, 2021

Can you please tell me the difference between kubectl apply and kubectl create. Why there are 3 different commands (apply, replace and create) doing the same thing?


Here are some key differences that you should consider when Kubectl apply vs create:


S. No.

Kubectl apply

Kubectl create

1.

It directly updates in the current live source, only the attributes which are given in the file.

It first deletes the resources and then creates it from the file provided.

2.

The file used in apply can be an incomplete spec

The file used in create should be complete

3.

Apply works only on some properties of the resources

Create works on every property of the resources

4.

You can apply a file that changes only an annotation, without specifying any other properties of the resource.

If you will use the same file with a reply command, the command would fail, due to the missing information.

Hope this helps!



Your Answer

Interviews

Parent Categories