Is "replace" in kubernetes equivalent to 'update'?

5/7/2018

I'm trying to implement a functionality similar to kubectl apply using Kazan, a kubernetes client in Elixir, and trying to understand how to perform a rolling update, in specifically the function replace_namespaced_deployment.

Having REST as background, where CRUD are the verbs to manipulate resources, Kubernetes' 'replace' sounds to me like an UPDATE, so I try to understand:

  • Why replace and not update
  • Is replace equivalent to update or not?
-- Alex.U
kubernetes

1 Answer

5/7/2018

Short answer: yes

Long answer: There is no "update" command in Kubernetes. If you want to edit any parameters of a resource, you can edit the yaml file, then run:

kubectl replace -f FILE

Note that some resources will throw an error saying it is not possible t modify. In that case you will need to delete the resource and create it again.

-- suren
Source: StackOverflow