K8S滚动更新Java项目的一些踩坑经验分享
作者:myluzh 分类: Kubernetes 长度:825 阅读:492
1、滚动更新之健康检查重要性
spec:
containers:
- name: my-container
readinessProbe:
tcpSocket:
port: 9999
initialDelaySeconds: 60
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 9999
initialDelaySeconds: 60
periodSeconds: 10
2、滚动更新之流量丢失解决方法(pod优雅退出)
这个操作的目的可能是为了在容器终止之前进行一些清理或收尾工作,例如保存临时数据或发送终止信号给其他进程。
spec:
containers:
- name: my-container
lifecycle:
preStop:
exec:
command:
- sh
- -c
- "sleep 5"
参考文章:【云原生】K8s pod优雅退出(postStart、terminationGracePeriodSeconds、preStop)