kubernetes PodDistruptionBudget阻止排出节点

rjee0c15  于 2023-11-17  发布在  Kubernetes
关注(0)|答案(1)|浏览(122)

我有一个PDB,可以防止在集群升级过程中驱逐其中一个pod。由于我将PDB的maxUnavailable设置为50%,并且一个pod已经启动并运行。因此另一个pod应该可以被驱逐。它有什么问题?

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  labels:
    group: x
    name: mydeployment
  name: mydeployment-pdb
  namespace: test
spec:
  maxUnavailable: 50%
  selector:
    matchLabels:
      group: x
      name: mydeployment

字符串
PDB的描述

Name:             mydeployment-pdb
Namespace:        test
Max unavailable:  50%
Selector:         group=x,name=mydeployment
Status:
    Allowed disruptions:  1
    Current:              2
    Desired:              1
    Total:                2
Events:                   <none>


Pod:

k get pods #(two pods are on the different nodes)
mydeployment-7465989f54-bkwgt                                    1/1     Running     0          6m54s
mydeployment-7465989f54-v9lg8                                    1/1     Running     0          2d15h


错误代码:

Normal  DeprovisioningBlocked  36s (x16 over 39m)    karpenter  Cannot deprovision node due to pdb test/mydeployment prevents pod evictions

axr492tv

axr492tv1#

您可能需要检查很多点来验证问题的根本原因。我建议出于故障排除的目的,尝试使用'kubectl drain'手动驱逐pod,看看是否会出现任何错误消息。还可以考虑检查PDB详细信息和不会干扰解除配置过程的集群配置。这里有一些文档可以帮助您解决用例。[1][2][3]
[1]https://karpenter.sh/docs/troubleshooting/#nodes-not-deprovisioned
[2][https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/](https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/)
[3]https://kubernetes.io/docs/concepts/workloads/pods/disruptions/#pod-disruption-budgets

相关问题