The extention of updateable fields in Pod

9/26/2021

I wonder why only some fields of a pod can be modified。 The updateable fields are:

  1. spec.containers*.image
  2. spec.initContainers*.image
  3. spec.activeDeadlineSeconds 1

In my actual business, I have a need to change the schedulername of a pod. So i change the validating codes in the file of validation.go. And i created a second scheduler named kube-scheduler-test. That is pod whose schedulername is kube-scheduler-test When i created a new pod whose schedulername is kube-scheduler-test, then the kube-scheduler-test will update the schedulername of pod to default-scheduler. And then default-scheduler will schedule this pod to specified node.

enter image description here

enter image description here

Could you explain why only some fields of a pod can be modified and whether my method of changing the schedulername acceptable or not?

-- hou dong
kubernetes
kubernetes-pod

1 Answer

9/26/2021

Pods are designed to be disposable, think of them as immutable. When you want to change anything about a Pod, you create a new Pod, and throw away the old Pod.

There are many articles explaining immutable infrastructure.

-- Jonas
Source: StackOverflow