如何在远程linux服务器上部署Kafka on kubernetes?

hjzp0vay  于 2022-11-21  发布在  Apache
关注(0)|答案(1)|浏览(131)

如何在远程机器上部署Kubernetes上的Kafka?2我已经成功地部署了Zookeeper吊舱,但Kafka吊舱不断崩溃(CrashLoopBackoff)。
下面是我正在使用的Kafka部署和服务yaml文件。我还对文件中KAFKA_ADVERTISED_HOST_NAME的值感到困惑。
第一个
我已遵循此教程:https://www.weave.works/blog/kafka-on-kubernetes-and-deploying-best-practice
Kubectl描述了荚给出

Name:             kafka-broker0-7cf7d4559-8frpn
Namespace:        default
Priority:         0
Service Account:  default
Node:             prd-stg-185/172.0.0.1
Start Time:       Fri, 18 Nov 2022 13:05:12 +0400
Labels:           app=kafka
                  id=0
                  pod-template-hash=7cf7d4559
Annotations:      cni.projectcalico.org/containerID: 82fe4ebcf2b634bd29b3a2c95292f70493c3ad7cf3dc80369fc9e95be619da34
                  cni.projectcalico.org/podIP: 192.168.123.0/32
                  cni.projectcalico.org/podIPs: 192.168.123.0/32
Status:           Running
IP:               192.168.123.0
IPs:
  IP:           192.168.123.0
Controlled By:  ReplicaSet/kafka-broker0-7cf7d4559
Containers:
  kafka:
    Container ID:   containerd://45c9ae210cbb6a5b29b87ea3bc3041f10c9132908fa4eba27a7a7f480b40c08e
    Image:          wurstmeister/kafka
    Image ID:       docker.io/wurstmeister/kafka@sha256:2d4bbf9cc83d9854d36582987da5f939fb9255fb128d18e3cf2c6ad825a32751
    Port:           9092/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Mon, 21 Nov 2022 09:36:45 +0400
      Finished:     Mon, 21 Nov 2022 09:37:08 +0400
    Ready:          False
    Restart Count:  752
    Environment:
      KAFKA_ADVERTISED_PORT:       30718
      KAFKA_ADVERTISED_HOST_NAME:  192.168.1.240
      KAFKA_ZOOKEEPER_CONNECT:     zoo1:2181
      KAFKA_BROKER_ID:             0
      KAFKA_CREATE_TOPICS:         admintome-test:1:1
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-66qch (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  kube-api-access-66qch:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason   Age                        From     Message
  ----     ------   ----                       ----     -------
  Warning  BackOff  6m16s (x17583 over 2d20h)  kubelet  Back-off restarting failed container
t9aqgxwy

t9aqgxwy1#

要在Kubernetes集群上部署Kafka,我强烈建议使用以下选项之一:

这两个选项都比“手动”创建和管理部署要容易得多。
至于所附教程的安全部分,我建议看一下Otterize intents operator或Strimzi用户操作符。

相关问题