Minikube上的Kafka:退回重启失败的容器

时间:2017-11-24 17:04:34

标签: docker kubernetes minikube

我需要在Minikube上找Kafka和Cassandra

主机操作系统是Ubuntu 16.04

$ uname -a
Linux minikuber 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Minikube正常开始:

$ minikube start
Starting local Kubernetes v1.8.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.

服务清单:

$ kubectl get services
NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.0.0.1     <none>        443/TCP   1d

Zookeeper和Cassandra正在运行,但kafka崩溃并出现错误“CrashLoopBackOff”

$ kubectl get pods
NAME                        READY     STATUS             RESTARTS   AGE
zookeeper-775db4cd8-lpl95   1/1       Running            0          1h
cassandra-d84d697b8-p5wcs   1/1       Running            0          1h
kafka-6d889c567-w5n4s       0/1       CrashLoopBackOff   25         1h

查看日志:

kubectl logs kafka-6d889c567-w5n4s -p

输出:

 waiting for kafka to be ready
...
 INFO Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
 INFO Waiting for keeper state SyncConnected (org.I0Itec.zkclient.ZkClient)
 WARN Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)
java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)
 INFO Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
 WARN Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)
...
 INFO Terminate ZkClient event thread. (org.I0Itec.zkclient.ZkEventThread)
 INFO Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
 INFO Session: 0x0 closed (org.apache.zookeeper.ZooKeeper)
 INFO EventThread shut down for session: 0x0 (org.apache.zookeeper.ClientCnxn)
 FATAL Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server '' with timeout of 6000 ms
...     
 INFO shutting down (kafka.server.KafkaServer)
 INFO shut down completed (kafka.server.KafkaServer)
 FATAL Exiting Kafka. (kafka.server.KafkaServerStartable)

任何人都可以帮忙解决重启容器的问题吗?

kubectl describe pod kafka-6d889c567-w5n4s

输出describe

Name:           kafka-6d889c567-w5n4s
Namespace:      default
Node:           minikube/192.168.99.100
Start Time:     Thu, 23 Nov 2017 17:03:20 +0300
Labels:         pod-template-hash=284457123
                run=kafka
Annotations:    kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicaSet","namespace":"default","name":"kafka-6d889c567","uid":"0fa94c8d-d057-11e7-ad48-080027a5dfed","a...
Status:         Running
IP:             172.17.0.5
Created By:     ReplicaSet/kafka-6d889c567
Controlled By:  ReplicaSet/kafka-6d889c567

有关容器的信息:

Containers:
  kafka:
    Container ID:   docker://7ed3de8ef2e3e665ba693186f5125c6802283e1fabca8f3c85eb584f8de19526
    Image:          wurstmeister/kafka
    Image ID:       docker-pullable://wurstmeister/kafka@sha256:2aa183fd201d693e24d4d5d483b081fc2c62c198a7acb8484838328c83542c96
    Port:           <none>
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Mon, 27 Nov 2017 09:43:39 +0300
      Finished:     Mon, 27 Nov 2017 09:43:49 +0300
    Ready:          False
    Restart Count:  1003
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-bnz99 (ro)

有关条件的信息:

Conditions:
  Type           Status
  Initialized    True 
  Ready          False 
  PodScheduled   True 

有关卷的信息:

Volumes:
  default-token-bnz99:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-bnz99
    Optional:    false
QoS Class:       BestEffort

有关活动的信息:

Events:
  Type     Reason      Age                   From               Message
  ----     ------      ----                  ----               -------
  Normal   Pulling     38m (x699 over 2d)    kubelet, minikube  pulling image "wurstmeister/kafka"
  Warning  BackOff     18m (x16075 over 2d)  kubelet, minikube  Back-off restarting failed container
  Warning  FailedSync  3m (x16140 over 2d)   kubelet, minikube  Error syncing pod

0 个答案:

没有答案