如何在minikube kafka集群上设置Cruise Control GUI

时间:2020-07-22 12:57:14

标签: kubernetes apache-kafka minikube

我已经使用linkedin Cruise Control在minikube上设置了一个kafka集群。我正在尝试通过遵循Cruise Control ui git hub page上的步骤来启用Cruise Control GUI,但无法正常工作。

当我从容器中卷曲地址时,它会返回我要输入的页面的html代码,但是当我在网络浏览器中尝试访问时,该页面无法连接。我认为我需要通过Service公开该Pod,但是它也不起作用。我还尝试更改了cruisecontrol.properties的属性,但是什么也没有。

Pod正在运行:

cruise-control-cbdd6bf54-prfts       1/1     Running     2          23h
kafka-0                              1/1     Running     1          23h
kafka-1                              1/1     Running     3          23h
kafka-2                              1/1     Running     1          23h
pzoo-0                               1/1     Running     0          23h
pzoo-1                               1/1     Running     0          23h
pzoo-2                               1/1     Running     1          23h
topic-cruise-control-metrics-fjdlw   0/1     Completed   0          23h
zoo-0                                1/1     Running     1          23h
zoo-1                                1/1     Running     1          23h

巡航控制舱

Containers:
  cruise-control:
    Container ID:   docker://b6d43bb8db047480374b19671a761013a2fba39a398215276ffb456a1d9a9f2d
    Image:          solsson/kafka-cruise-control@sha256:f48acf73d09e6cf56f15fd0b9057cad36b3cee20963a52d263732bf7e5c1aae1
    Image ID:       docker-pullable://solsson/kafka-cruise-control@sha256:f48acf73d09e6cf56f15fd0b9057cad36b3cee20963a52d263732bf7e5c1aae1
    Port:           8090/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Tue, 21 Jul 2020 10:32:27 -0300
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Tue, 21 Jul 2020 10:31:47 -0300
      Finished:     Tue, 21 Jul 2020 10:31:59 -0300
    Ready:          True
    Restart Count:  2
    Requests:
      cpu:        100m
      memory:     512Mi
    Readiness:    tcp-socket :8090 delay=0s timeout=1s period=10s #success=1 #failure=3
    Environment:  <none>
    Mounts:
      /opt/cruise-control/config from config (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-5kp9f (ro)

cruisecontrol.properties

configurations for the webserver
# ================================

# HTTP listen port
webserver.http.port=8090

# HTTP listen address
webserver.http.address=0.0.0.0

# Whether CORS support is enabled for API or not
webserver.http.cors.enabled=false

# Value for Access-Control-Allow-Origin
webserver.http.cors.origin=http://localhost:8080/

# Value for Access-Control-Request-Method
webserver.http.cors.allowmethods=OPTIONS,GET,POST

# Headers that should be exposed to the Browser (Webapp)
# This is a special header that is used by the
# User Tasks subsystem and should be explicitly
# Enabled when CORS mode is used as part of the
# Admin Interface
webserver.http.cors.exposeheaders=User-Task-ID

# REST API default prefix
# (dont forget the ending *)
webserver.api.urlprefix=/kafkacruisecontrol/*

# Location where the Cruise Control frontend is deployed
webserver.ui.diskpath=./cruise-control-ui/dist/

# URL path prefix for UI
# (dont forget the ending *)
webserver.ui.urlprefix=/*

CC服务

Name:              cruise-control
Namespace:         mindlabs
Labels:            <none>
Annotations:       Selector:  app=cruise-control
Type:              ClusterIP
IP:                10.98.201.106
Port:              <unset>  8090/TCP
TargetPort:        8090/TCP
Endpoints:         172.18.0.14:8090
Session Affinity:  None
Events:            <none>

感谢您的帮助!

2 个答案:

答案 0 :(得分:1)

结果是我必须将本地8090端口转发到群集8090端口。 我使用kubectl port-forward svc/cruise-control 8090:8090

解决了该问题

答案 1 :(得分:1)

默认情况下,只能通过Kubernetes集群中的内部IP地址访问Pod。

要使容器可以从Kubernetes虚拟网络外部访问,您必须将Pod作为Kubernetes服务公开。

在Minikube上,LoadBalancer类型使服务可以通过minikube service command访问。需要两个步骤:

kubectl expose deployment _deployment_name_  --type=LoadBalancer --port=8080
minikube service _deployment_name_

对于这种特殊情况,需要将“ deployment_name ”替换为“ cruise-control”

这会打开一个浏览器窗口,为您的应用提供服务并显示应用的响应。