Below, we have a Yaml configuration file for a deployment with two "nginx" replicas:


The "deployment-1.yaml" file:


The non-disruptive way of updating a deployment:

The below command opens the Yaml file "deployment-1.yaml" in the Vi editor:


After updating the Yaml file "deployment-1" in Vi, we save it and we apply the changes using the below command:



Remark:

Vi is the default editor. It could be changed using the environment variable "KUBE_EDITOR".

The "Vi" editor basic commands:

Below are some useful "Vi" editor commands:
  • :wq + <Return> : quits Vi after saving the file
  • :q + <Return> :  exits Vi
  • :q! + <Return> : quits Vi without saving
  • i : inserts text before the cursor until we hit <Esc>
  • a : adds text after the cursor until we hit <Esc> 
  • j : moves cursor down one line
  • k : moves cursor up one line
  • h : moves cursor to the left one character
  • l : moves cursor to the right one character
Disruptive updates "deployment":

To force the update of our deployment that for some reason couldn't be done non-disruptively, we use the below command to delete and re-create our resource.

After modifying our Yaml file, we can "force" the update using the below command:


Brando Sabatini and Ikbal C ©. Powered by Blogger.