在小兵失败后,Kubenetes不会恢复服务

时间:2016-10-06 22:12:31

标签: containers kubernetes

我正在测试Kubernetes冗余功能,测试台由一个主人和三个爪牙组成。

案例:我正在运行一项服务,其中包含3个副本1和2,而minion3已停止

[root @ centos-master ajn]#kubectl get nodes

  

姓名状态年龄
  centos-minion3 NotReady 14d
  centos-minion1 Ready 14d
  centos-minion2 Ready 14d

[root @ centos-master ajn]#kubectl describe pods $MYPODS | grep Node:

  

节点:centos-minion2 / 192.168.0.107
  节点:centos-minion1 / 192.168.0.155
  节点:centos-minion2 / 192.168.0.107

测试:启动minion3并停止minion2(运行2个pod)后

[root @ centos-master ajn]#kubectl get nodes

  

姓名状态年龄
  centos-minion3 Ready 15d
  centos-minion1 Ready 14d
  centos-minion2 NotReady 14d

结果:服务种类无法从小兵失败中恢复,Kubernetes继续在失败的小兵身上显示pod。

[root @ centos-master ajn]#kubectl describe pods $MYPODS | grep Node:

  

节点:centos-minion2 / 192.168.0.107
  节点:centos-minion1 / 192.168.0.155
  节点:centos-minion2 / 192.168.0.107

预期结果(至少在我的理解中):该服务应该建立在当前可用的第1和第3部分上

据我了解,服务类型的作用是使部署“全局”可用,因此我们可以独立于集群在集群中的位置来引用它们。

我做错了吗?

我正在使用以下yaml规范:

apiVersion:v1
 kind:ReplicationController
 元数据:
 名称:nginx-www
 规格:
 复制品:3
 选择:
 应用:nginx的
 模板:
 元数据:
 标签:
 app:nginx
 规格:
 集装箱:
  - 名称:nginx
 image:nginx
 港口:
  - containerPort:80

1 个答案:

答案 0 :(得分:1)

看起来你总是试图阅读$MYPODS中引用的相同pod。 Pod名称由ReplicationController动态创建,因此不是kubectl describe pods $MYPODS而是尝试使用它:

kubectl get pods -l app=nginx -o wide

这将始终为您的应用提供当前安排的广告连播。

相关问题