Difference between kubectl apply and kubectl create?

0 votes
From my understanding of the documentation: kubectl apply = kubectl create + kubectl replace. So, if I'm creating resources for the first time, I should use kubectl create. If I want to update something that already exists, I use kubectl replace. If I want to do both then I do kubectl apply.

I just want to know why are there three different commands doing essentially the same thing? Or is there some key difference that I'm missing?
Sep 10, 2018 in Kubernetes by Atul
• 10,240 points
10,324 views

1 answer to this question.

0 votes

These are two very different approaches. kubectl create uses Imperative Management. Here You specify what you want to create, delete or replace.

kubectl apply uses what we call Declarative approach. Here we tell the api How we want the cluster to look like. So even if you've applied changes to a live object, your changes are maintained.

More information on object management in kubernetes Kubernetes Object Management.

answered Sep 10, 2018 by ajs3033
• 7,280 points

Related Questions In Kubernetes

0 votes
1 answer

What's the difference between kubernetes load balancer and ingress controller?

Load Balancer: So Kubernetes LoadBalancer just points ...READ MORE

answered Jan 4, 2019 in Kubernetes by DareDev
• 6,870 points
5,993 views
0 votes
2 answers

Difference between a Deployment and a DaemonSet in Kubernetes

Adding to @Rohit's answer, I'll explain about ...READ MORE

answered Jan 6, 2019 in Kubernetes by Ramya
2,514 views
0 votes
1 answer
0 votes
1 answer

Difference between deploying apps on hosts and container

The left side architecture represents deploying applications ...READ MORE

answered Apr 17, 2019 in Kubernetes by Sahit
500 views
0 votes
1 answer

permissions related to AWS ECR

if you add allowContainerRegistry: true, kops will add those permissions ...READ MORE

answered Oct 9, 2018 in Kubernetes by Kalgi
• 51,970 points
157 views
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
8,850 views
0 votes
1 answer

What's the difference betweena a deployment and a stateful set?

Both the deployments and replication controllers are ...READ MORE

answered Oct 3, 2018 in Kubernetes by ajs3033
• 7,280 points
2,607 views
0 votes
1 answer

automating cluster setup and app deplument on kubernetes

Go through Google Cloud Deployment Manager. it automates ...READ MORE

answered Jul 5, 2018 in Kubernetes by ajs3033
• 7,280 points
102 views