Best practices for upgrading static pod in kubernetes

2/15/2019

We have deployed etcd of k8s using static pod, it's 3 of them. We want to upgrade pod to define some labels and readiness probe for them. I have searched but found no questions/article mentioned. So I'd like to know the best practice for upgrading static pod.

For example, I found modifying yaml file directly may result pod unscheduled for a long time, maybe I should remove the old file and create a new file?

-- xudifsd
kubernetes

1 Answer

2/17/2019

You need to recreate the pod if you want to define readiness probe for it, for labels an edit should suffice.

Following error is thrown by Kubernetes if editing readinessProbe:

# * spec: Forbidden: pod updates may not change fields other than `spec.containers[*].image`, `spec.initContainers[*].image`, `spec.activeDeadlineSeconds` or `spec.tolerations` (only additions to existing tolerations)

See also https://stackoverflow.com/a/40363057/499839

Have you considered using DaemonSets? https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/

-- Mika Vatanen
Source: StackOverflow