요약하자면 kubectl create와 kubectl apply는 모두 생성을 위해 사용될 수 있다.
하지만 생성하고자하는 대상이 이미 존재할 때 kubectl create는 에러를 발생시키며 kubectl apply는 이미 존재하는 대상을 apply 하는 내용으로 수정시킨다.
자세한 내용은 아래 내용을 참고해보자
https://stackoverflow.com/questions/47369351/kubectl-apply-vs-kubectl-create
kubectl apply vs kubectl create?
What I understood by the documentation is that: kubectl create Creates a new k8s resource in the cluster kubectl replace Updates a resource in the live cluster kubectl apply If I want to do c...
stackoverflow.com
위에서 언급했듯이 apply는 생성과 수정 모두 할 수 있다. edit으로도 실행중인 리소스에 변경을 취할 수 있으며 apply가 수정 사항을 yaml 등으로 전달하는 대신 edit은 에디터가 열려서 바로 수정하고 저장하면 변경 사항이 적용된다.
사실 나도 뉴비라 얼마나 더 다양한 옵션이 가능할지는 모르고 내가 아는 용례 한에서 기록한 내용이다.
수정과 관련한 명령어들(apply, edit, replace, patch)에 관한 상세한 내용은 아래 링크에서 확인할 수 있을 것 같다.
https://blog.atomist.com/kubernetes-apply-replace-patch/
Kubernetes Apply vs. Replace vs. Patch
Kubernetes offers several ways to update resources: apply, edit, patch, and replace. Unfortunately, there seems to be some confusion about what each does and when to use them. This post explains the various approaches and when to use each.
blog.atomist.com
Reference
- Udemy lecture: Kubernetes for the Absolute Beginners - Hands-on