首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >保持Kubernetes容器平台稳定性

保持Kubernetes容器平台稳定性

作者头像
jeremyxu
发布2019-05-26 08:37:46
3.5K0
发布2019-05-26 08:37:46
举报

这两天搭建了一套新的kubernetes环境,由于这套环境会被用于演示,所以持续观察了好几天这套环境,发现不少容器平台稳定性的问题,这里记录一下以备忘。

环境

我们这套环境的操作系统是4.4.131-20181130.kylin.server aarm64 GNU/Linux,64核128G内存。

各类问题

docker的问题

最开始用的docker版本为18.03.1-ce,但在运行四五十个容器后,出现了docker info不响应的问题。因为情况紧急,没有查明原因,临时将docker版本降回ubuntu-ports xenial源里的docker.io了,版本为17.03.2,降级后,docker info终于一直有响应了。

过了一晚上,第二天再来看,发现有部分pod的健康检查失败,同时exec进pod再exit会卡住,现象如下:

$ kubectl describe pod some-pod
...
Liveness probe failed. # 健康检查失败
Readiness probe failed. # 健康检查失败
...

$ kubectl exec -ti some-pod -- sh
> exit  # 这里会卡住

这次查了下原因,发现是低版本docker的bug,见bug记录

After some time a container becomes unhealthy (because of “containerd: container not found”). The container is running and accessible but it’s not possible to “exec” into it. The container is also marked “unhealthy” because the healhcheck cannot be executed inside the container (same message). Steps to reproduce the issue:

  1. Run a container (success)
  2. Stop and remove container (success)
  3. Build new image (success)
  4. Start the image (success)
  5. The container is accessible but is unhealty and it’s not possible to “exec” into it

官方建议将docker升级至17.12之后,于是将docker升级至17.12.1-ce,问题终于解决。

kubelet的问题

今天下午又发现kubelet调度pod异常缓慢,kubelet的日志里疯狂打印以下的报错:

E0521 16:45:28.353927   58235 kubelet_volumes.go:140] Orphaned pod "xxxxxx" found, but volume paths are still present on disk : There were a total of 1 errors similar to this. Turn up verbosity to see them.

查了下发现是kubernetes的bug,见bug记录,官方还没有将这个bug的PR合进主干代码,不过还好找到阿里容器服务提供的一个Workaround方法,简单改了下这个脚本,将其加入cron定时任务即可。

etcd的问题

之前发现创建了一个deployment,但一直没有pod产生出来,查到etcd服务日志中有大量下面的报错:

2018-10-22 11:22:16.364641 W | etcdserver: read-only range request "key:\"xxx\" range_end:\"xxx\" " with result "range_response_c
ount:xx size:xxx" took too long (117.026891ms) to execute

查到了相关的bug记录,说是可能是磁盘性能太差导致的。又查了etcd的文档,其中有如下说明

Usually this issue is caused by a slow disk. The disk could be experiencing contention among etcd and other applications, or the disk is too simply slow (e.g., a shared virtualized disk). To rule out a slow disk from causing this warning, monitor backend_commit_duration_seconds (p99 duration should be less than 25ms) The second most common cause is CPU starvation. If monitoring of the machine’s CPU usage shows heavy utilization, there may not be enough compute capacity for etcd. Moving etcd to dedicated machine, increasing process resource isolation cgroups, or renicing the etcd server process into a higher priority can usually solve the problem.

再查了下系统的iowait,果然很高,最后挂了一个独立的磁盘,专门用于etcd服务的数据存储,问题得到好转。

flannel的问题

kubernetes在运行时,偶然发现flannel的pod因为OOM被Killed掉了,在该pod重启的过程中此node节点上的服务其它节点均不可访问。

查了下,发现官方的bug记录。解决办法就是增加pod使用的资源限制:

        resources:
          limits:
            cpu: 100m
            memory: 256Mi # 默认为50Mi,增大这个数据
          requests:
            cpu: 100m
            memory: 50Mi

总结

虽说现在容器平台蒸蒸日上,但还是有不少坑待我们去趟的,我辈须努力啊。

参考

  1. https://github.com/moby/moby/issues/35091
  2. https://xigang.github.io/2018/12/31/Orphaned-pod/
  3. https://github.com/kubernetes/kubernetes/issues/60987
  4. https://coreos.com/etcd/docs/latest/faq.html#performance
  5. https://bingohuang.com/etcd-operation-3/
  6. https://github.com/coreos/flannel/issues/963
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019-05-21,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 环境
  • 各类问题
    • docker的问题
      • kubelet的问题
        • etcd的问题
          • flannel的问题
          • 总结
          • 参考
          相关产品与服务
          容器镜像服务
          容器镜像服务(Tencent Container Registry,TCR)为您提供安全独享、高性能的容器镜像托管分发服务。您可同时在全球多个地域创建独享实例,以实现容器镜像的就近拉取,降低拉取时间,节约带宽成本。TCR 提供细颗粒度的权限管理及访问控制,保障您的数据安全。
          领券
          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档