kubernetes部署kafka-manager

  sre

下载

主页
下载

编译kafka-manager 修改配置文件

安装sbt编译环境

cd kafka-manager-2.0.0.2
./sbt clean dist #较长时间,很久
cd target/universal
unzip kafka-manager-2.0.0.2.zip
cd kafka-manager-2.0.0.2/conf

修改application.conf,此处以zk-cs为例

...
kafka-manager.zkhosts="zk-cs:2181"
...

打包 打镜像

cd ../.. 
tar zcvf kafka-manager-2.0.0.2.tgz  kafka-manager-2.0.0.2

Dockerfile

#push hub.my.com/base/kafka-manager
FROM hub.my.com/base/java8
MAINTAINER me <me>
LABEL Description="kafka-manager-2.0.0.2"
ADD kafka-manager-2.0.0.2.tgz /usr/local/
CMD /usr/local/kafka-manager-2.0.0.2/bin/kafka-manager -Dconfig.file=/usr/local/kafka-manager-2.0.0.2/conf/application.conf
EXPOSE 9000

打镜像

docker build -t hub.my.com/base/kafka-manager .
docker push hub.my.com/base/kafka-manager

k8s

svc

apiVersion: v1
kind: Service
metadata:
  name: kafka-manager
  labels:
    kafka: manager
spec:
  type: NodePort
  ports:
  - port: 9000
    name: kafka-manager
    targetPort: 9000
    nodePort: 30069
    protocol: TCP
  selector:
    kafka: manager

Deployment

kind: Deployment
apiVersion: extensions/v1beta1
metadata:
  name: kafka-manager
spec:
  replicas: 1
  selector:
    matchLabels:
      kafka: manager
  template:
    metadata:
      labels:
        kafka: manager
    spec:
      containers:
      - name: kafka-manager
        image: hub.my.com/base/kafka-manager
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 9000

访问nodeport端口,添加一个集群即可

LEAVE A COMMENT

Captcha Code