kubectl等待有时会意外超时 [英] kubectl wait sometimes timed out unexpectedly

查看:90
本文介绍了kubectl等待有时会意外超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是在BitBucket Pipeline的最后一步中添加了kubectl wait --for=condition=ready pod -l app=appname --timeout=30s,以报告如果新pod产生错误的部署失败.

I just add kubectl wait --for=condition=ready pod -l app=appname --timeout=30s in the last step of BitBucket Pipeline to report any deployment failure if the new pod somehow producing error.

我知道等待实际上并不一致.有时,即使来自新映像的新pod没有产生任何错误,它也会超时,pod会转为就绪状态.

尝试始终更改Deployment.yaml或每次推送新映像进行测试,结果均不一致.

Try to always change deployment.yaml or push newer image everytime to test this, the result is inconsistent.

顺便说一句,我认为使用kubectl rollout status不适合,我认为是因为部署完成后才返回而无需等待Pod准备就绪.

BTW, I believe using kubectl rollout status doesn't suitable, I think because it just return after the deployment done without waiting for pod ready.

请注意,如果我将超时从30s更改为5m,则没有太大区别,因为应用或推出重新启动是非常即时的.

Note that there is not much difference if I change timeout from 30s to 5m since apply or rollout restart is quite instant.

  • kubectl版本:1.17
  • AWS EKS:最新的1.16

推荐答案

我将这个答案放在更好的可见性中,如注释中所述,这确实解决了kubectl wait行为的一些问题.

I'm placing this answer for better visibility as noted in the comments this indeed solves some problems with kubectl wait behavior.

我设法复制该问题,并且当我的客户端版本比服务器版本旧时,出现了一些超时.您必须将客户端版本与服务器匹配,以使kubectl wait正常工作.

I managed to replicate the issue and have some timeouts when my client version was older than server version. You have to match your client version with server in order to kubectl wait work properly.

这篇关于kubectl等待有时会意外超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆