Kubernetes pod desc显示“连接被拒绝”错误

时间:2018-11-01 04:10:04

标签: kubernetes kubectl

我是Kubernetes的新手。我正在解决将Pod身份停留在ContainerCreating上的想法。我正在使用AWS(https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html#eks-guestbook)的示例应用程序,该示例与官方示例(https://kubernetes.io/docs/tutorials/stateless-application/guestbook/)非常相似。

非常感谢任何为寻找根本原因提供指导的人:

为什么我会收到conn拒绝错误,端口50051会做什么?谢谢。

$ kubectl get pods --all-namespaces

NAMESPACE     NAME                        READY   STATUS              RESTARTS   AGE
default       guestbook-8k9pp             0/1     ContainerCreating   0          15h
default       guestbook-b2n49             0/1     ContainerCreating   0          15h
default       guestbook-gtjnj             0/1     ContainerCreating   0          15h
default       redis-master-rhwnt          0/1     ContainerCreating   0          15h
default       redis-slave-b284x           0/1     ContainerCreating   0          15h
default       redis-slave-vnlj4           0/1     ContainerCreating   0          15h
kube-system   aws-node-jkfg8              0/1     CrashLoopBackOff    273        1d
kube-system   aws-node-lpvn9              0/1     CrashLoopBackOff    273        1d
kube-system   aws-node-nmwzn              0/1     Error               274        1d
kube-system   kube-dns-64b69465b4-ftlm6   0/3     ContainerCreating   0          4d
kube-system   kube-proxy-cxdj7            1/1     Running             0          1d
kube-system   kube-proxy-g2js4            1/1     Running             0          1d
kube-system   kube-proxy-rhq6v            1/1     Running             0          1d

$ kubectl describe pod guestbook-8k9pp

Name:           guestbook-8k9pp
Namespace:      default
Node:           ip-172-31-91-242.ec2.internal/172.31.91.242
Start Time:     Wed, 31 Oct 2018 04:59:11 -0800
Labels:         app=guestbook
Annotations:    <none>
Status:         Pending
IP:             
Controlled By:  ReplicationController/guestbook
Containers:
  guestbook:
    Container ID:   
    Image:          k8s.gcr.io/guestbook:v3
    Image ID:       
    Port:           3000/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ContainerCreating
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-jb75l (ro)
Conditions:
  Type           Status
  Initialized    True 
  Ready          False 
  PodScheduled   True 
Volumes:
  default-token-jb75l:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-jb75l
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason                  Age                    From                                    Message
  ----     ------                  ----                   ----                                    -------
  Normal   SandboxChanged          11m (x19561 over 13h)  kubelet, ip-172-31-91-242.ec2.internal  Pod sandbox changed, it will be killed and re-created.
  Warning  FailedCreatePodSandBox  74s (x19368 over 13h)  kubelet, ip-172-31-91-242.ec2.internal  Failed create pod sandbox: rpc error: code = Unknown desc = NetworkPlugin cni failed to set up pod "guestbook-8k9pp_default" network: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: **desc = "transport: Error while dialing dial tcp 127.0.0.1:50051: connect: connection refused"**

2 个答案:

答案 0 :(得分:2)

我创建的Kubernetes集群在AWS EKS上。我通过EKS控制台手动创建了EKS集群。

我用EKS群集(https://amazon-eks.s3-us-west-2.amazonaws.com/cloudformation/2018-08-30/amazon-eks-vpc-sample.yaml)的官方VPC示例创建了第二个群集,它现在似乎正在工作。

因此,问题应该出在VPC配置上。一旦我弄清实际出了什么问题,将在此处发布信息,谢谢。

答案 1 :(得分:0)

我有类似的问题。错误消息相同,但Pod设置简单得多。 使用kubectl get pods --all-namespaces可以发现一个特定节点具有CrashLoopBackOff。

我扩展了节点,然后再次扩展(有效地重新创建了该节点),这个问题似乎已经消失了。