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,190 points
3,293 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,000 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,520 points
84 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
261 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
20 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
• 35,720 points
30 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
447 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,000 points
151 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,000 points
26 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.