Kubernetes Notes
  • README
  • 序:Kubernetes之道
  • 搭建开发环境
    • 搭建本地开发测试环境
  • 基本概念
    • Workloads
      • StatefulSet
    • 认证鉴权
      • 理解证书
      • Kubelet配置
    • 垃圾回收
    • Service
  • 基础组件
    • Scheduler
    • 自动扩缩容(HPA)
  • 容器运行时(Container Runtime)
    • CRI
    • Docker
      • 安装配置Docker
      • Docker FAQ
    • Containerd
  • 资源隔离与限制
    • 基础知识
      • Cgroup
      • Namespaces
    • CPU
    • Memory
    • 网络出/入带宽
    • GPU
    • Container
    • FAQ
  • 网络
    • 基础知识
      • Linux network interfaces
      • Iptables
      • Overlay network
    • CNI
    • Flannel
      • Flannel原理
      • host-gw
      • vxlan
      • ipip
    • Calico
    • Cilium
  • Service Mesh
    • Istio
  • 扩展Kubernetes
    • Admission controller
    • Custom resource definition(CRD)
    • Scheduler extender
    • 扩展资源维度
    • Kubectl plugin
    • Aggregator
    • Device plugin
  • 现网问题
    • Kubernetes
    • ETCD
    • Docker
  • 最佳实践
    • 各组件参数配置调优
    • 各大公司生产环境实践
    • 如何打造一个Kubernetes平台
  • 生产力小工具
    • 生成特定权限和配额的kubeconfig
  • 社区贡献
  • 学习资料
  • 附录:RTFSC
    • Informer
    • Pod deletion
Powered by GitBook
On this page

Was this helpful?

  1. 基本概念
  2. Workloads

StatefulSet

PreviousWorkloadsNext认证鉴权

Last updated 2 years ago

Was this helpful?

StatefulSet目前有一个问题,如果它管理的pod所在的kubelet节点挂了,StatefulSet controller没法强制删除该pod,只有下面两种情况能强制删除pod(见):

  • The Node object is deleted (either by you, or by the ).

    管理员手动delete掉node节点,但这需要人工干预,很麻烦,而且可能不及时。如果想让Node Controller delete掉node,需要给它提供信息,这通常需要和云对接():

    The second is keeping the node controller’s internal list of nodes up to date with the cloud provider’s list of available machines. When running in a cloud environment, whenever a node is unhealthy, the node controller asks the cloud provider if the VM for that node is still available. If not, the node controller deletes the node from its list of nodes.

  • The kubelet on the unresponsive Node starts responding, kills the Pod and removes the entry from the apiserver.

    Kubelet节点成功启动了。

  • Force deletion of the Pod by the user.

    用户删除。

如果kubelet机器在较短的时间能自动恢复,当然第二种方式更好。否则:

  • 公有云环境

    与node controller对接,告诉node controller kubelet所在机器的状态,决定是否delete掉这个kubelet节点。

  • 非公有云环境

    很难和Node controller对接,因此最终需要人来处理。但有时候人去处理会不及时,也很麻烦。这时候,我们可以写一些运维工具或node operator去检查机器状态(通过ssh、ping等方式),如果发现kubelet节点挂了一段时间了,就直接delete掉,这样pod就可以正常迁移了。

参考资料

  • Force Delete StatefulSet Pods: https://kubernetes.io/docs/tasks/run-application/force-delete-stateful-set-pod/

  • Nodes: https://kubernetes.io/docs/concepts/architecture/nodes/

  • How to Delete Pods from a Kubernetes Node with Examples: https://spacelift.io/blog/kubectl-delete-pod

Force Delete StatefulSet Pods
Node Controller
Node Controller