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
5,404 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 in Kubernetes by DareDev
• 6,810 points
392 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 in Kubernetes by Ramya
770 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 in Kubernetes by Sahit
44 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
• 40,420 points
61 views
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

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

answered Jan 17 in Others by anonymous
2,050 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
553 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
42 views