![](https://habrastorage.org/webt/b6/z6/p0/b6z6p0ovllx9tbiusy2vwhpgwvs.png)
Protéger une capsule contre l'expulsion avec les budgets de perturbation de capsule dans Kubernetes
(. . â ) Kubernetes-. , podâ . preStop
podâ , , podâ . podâ, podâ, . PodDisruptionBudgets ( PDB), .
PodDisruptionBudgets: podâ
pod (PDB) â , podâ ( ).
, podâ , , , , . drain , podâ, .
pod PodDisruptionBudget
, podâ . , pod (PDB), pod Nginx deployment-, :
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: nginx-pdb
spec:
minAvailable: 1
selector:
matchLabels:
app: nginx
Kubernetes, , 1 pod, app: nginx
. , Kubernetes podâ drain-, podâ drain-.
, , . prestop-, readiness probes service . , . , , , , .
, :
![](https://habrastorage.org/webt/h7/ym/76/h7ym76qbiuqx0ynji-0-mlkznku.png)
, . , podâ :
![](https://habrastorage.org/webt/cn/es/tv/cnestvhneu1edyu1phqnkjamg-c.png)
podâ, drain . , drain , podâ Nginx. drain ( , ), drain .
, , , drain . , drain , ââ ( NoSchedule
), podâ . .
, , drain ââ podâ :
![](https://habrastorage.org/webt/ye/gt/e1/yegte1mhgszz6ieqtmns9w-dk58.png)
, , drain podâ . , drain control plane, Pod Disruption Budget (PDB).
, control plane , PDB . , control plane , . , 2 podâ. podâ 1, PDB . , pod , , , . , , control plane , , podâ 0, PDB.
, , 1 . drain 1 podâ, drain 2 :
![](https://habrastorage.org/webt/xs/cj/ww/xscjwwuicsdrxx-3kkxbz-rxejo.png)
![](https://habrastorage.org/webt/xm/sz/8i/xmsz8ivb4zzqagudnmtlvwefmuw.png)
podâ , Deployment
. ââ NoSchedule
, scheduler :
![](https://habrastorage.org/webt/nj/a_/sn/nja_snswolramxrn9covllmid0i.png)
, pod , 1 , drain 1 .
drain 2 control plane PDB, . , pod, , , , drain 2 , podâ (PDB). :
![](https://habrastorage.org/webt/02/k8/hl/02k8hljlnzerknuduyfa2z6p6js.png)
![](https://habrastorage.org/webt/t4/79/5r/t4795rvmfkif6mcicqm4mcnraci.png)
![](https://habrastorage.org/webt/3t/5g/b5/3t5gb58ipxyocoabrp3byp22gew.png)
, podâ , , podâ . , - drain , Kubernetes !
, :
- lifecycle , .
- podâ
- podâ (PDB), , podâ .
, â !
! . terratest, k8s endpoint. , , 300 . , , .
Kubernetes AWS , Gruntwork.io.
: