Dockfile

FROM jdk:8
# 申明变量
ARG APP_DIR

# 设置工作目录
WORKDIR /wyyt/app

#新增tar.gz格式安装包至工作目录
ADD ${APP_DIR} /wyyt/app

# 容器启动
CMD /wyyt/app/kafka-manager/bin/kafka-manager -Dconfig.file=/wyyt/app/kafka-manager/conf/application.conf -Dhttp.port=9000

configmap

apiVersion: v1
kind: ConfigMap
metadata:
  name: acm-config
  namespace: kafka-manager
data:
  kafka.conf: |
    play.crypto.secret="^<csmm5Fx4d=r2HEX8pelM3iBkFVv?k[mc;IZE<_Qoq8EkX_/7@Zt6dP05Pzea3U"
    play.crypto.secret={?APPLICATION_SECRET}
    play.i18n.langs=["en"]

    play.http.requestHandler = "play.http.DefaultHttpRequestHandler"
    play.http.context = "/"
    play.application.loader=loader.KafkaManagerLoader

    kafka-manager.zkhosts="192.168.60.12:2181,192.168.60.12:2182,192.168.60.12:2183"
    kafka-manager.zkhosts={?ZK_HOSTS}
    pinned-dispatcher.type="PinnedDispatcher"
    pinned-dispatcher.executor="thread-pool-executor"
    application.features=["KMClusterManagerFeature","KMTopicManagerFeature","KMPreferredReplicaElectionFeature","KMReassignPartitionsFeature"]

    akka {
      loggers = ["akka.event.slf4j.Slf4jLogger"]
      loglevel = "INFO"
    }


    basicAuthentication.enabled=false
    basicAuthentication.username="admin"
    basicAuthentication.password="password"
    basicAuthentication.realm="Kafka-Manager"
    basicAuthentication.excluded=["/api/health"] # ping the health of your instance without authentification

    kafka-manager.consumer.properties.file=${?CONSUMER_PROPERTIES_FILE}

deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: kafka-manager
  namespace: kafka-manager
spec:
  replicas: 1
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  selector:
    matchLabels:
      app: kafka-manager
  template:
    metadata:
      labels:
        app: kafka-manager
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 1
            podAffinityTerm:
              topologyKey: kubernetes.io/hostname
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - kafka-manager
      volumes:
        - name: localtime
          hostPath:
              path: /etc/localtime
        - name: acm-config
          configMap:
              name: acm-config
              items:
              - key: kafka.conf
                path: application.conf
      containers:
      - name: kafka-manager
        image: zenko/kafka-manager:1.3.3.22
        imagePullPolicy: Always
        readinessProbe:
            initialDelaySeconds: 30
            timeoutSeconds: 3
            successThreshold: 1
            failureThreshold: 5
            periodSeconds: 5
            tcpSocket:
              port: 9000
        livenessProbe:
           initialDelaySeconds: 60
           timeoutSeconds: 3
           successThreshold: 1
           failureThreshold: 5
           periodSeconds: 5
           tcpSocket:
             port: 9000
        volumeMounts:
          - name: localtime
            mountPath: /etc/localtime
          - name: acm-config
            mountPath: /wyyt/app/kafka-manager/conf
        resources:
          limits:
            cpu: 500m
            memory: 500Mi
        ports:
        - containerPort: 9000
          name : kafka-manager
          protocol: TCP
      imagePullSecrets:
        - name: harbor-secrets



service

kind: Service
apiVersion: v1
metadata:
  labels:
    app: kafka-manager
  name: kafka-manager
  namespace: kafka-manager
  annotations:
    service.beta.kubernetes.io/azure-load-balancer-internal: "true"
spec:
  sessionAffinity: ClientIP
  ports:
    - port: 9000
      targetPort: 9000
      protocol: TCP
  selector:
    app: kafka-manager

ingress

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kafka-manager
  namespace: kafka-manager
  annotations:
    kubernetes.io/ingress.class: "nginx"
spec:
  rules:
  - host: kafka.test027.com
    http:
      paths:
      - path: /
        backend:
          serviceName: kafka-manager
          servicePort: 9000

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code