当前位置:   article > 正文

k8s部署kafka-ui_kafka-ui-api

kafka-ui-api

kafka-ui-deploy.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: kafka-ui
  labels:
    app: kafka-ui
spec:
  selector:
    matchLabels:
      app: kafka-ui
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 0
      maxSurge: 1
  # minReadySeconds: 30
  template:
    metadata:
      labels:
        app: kafka-ui
        tag: kobe
    spec:
      containers:
        - name: kafka-ui
          image: provectuslabs/kafka-ui:v0.5.0
          imagePullPolicy: IfNotPresent
          env:
            - name: TZ
              value: "Asia/Shanghai"
            - name: LANG
              value: C.UTF-8
            - name: LC_ALL
              value: C.UTF-8
            - name: KAFKA_CLUSTERS_0_NAME
              value: local
            - name: KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS
              value: kafka.logging:9092
              #          livenessProbe:
              #            failureThreshold: 2
              #            initialDelaySeconds: 30
              #            periodSeconds: 10
              #            successThreshold: 1
              #            tcpSocket:
              #              port: 8080
              #            timeoutSeconds: 2
              #          readinessProbe:
              #            failureThreshold: 2
              #            initialDelaySeconds: 30
              #            periodSeconds: 10
              #            successThreshold: 1
              #            tcpSocket:
              #              port: 8080
              #            timeoutSeconds: 2
          ports:
          - containerPort: 8080
            protocol: TCP
          resources:
            limits:
              cpu: 194m
              memory: 500Mi
            requests:
              cpu: 80m
              memory: 300Mi
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      securityContext: {}
      serviceAccountName: default

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69

kafka-ui-service.yaml

---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: kafka-ui
  name: kafka-ui-service
spec:
  ports:
    - name: http
      protocol: TCP
      port: 8080
      targetPort: 8080
  selector:
    app: kafka-ui
  sessionAffinity: None
  type: NodePort

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

这里将存活性探针和就绪性探针都注释了,加了刚开始怎么都起不来,原因是kafka-ui启动的时间比较长,然后我这边设置的时间比较短,每次它启动到一半,就绪性探针没探测到8080端口,就会重启该pod,然后就会陷入一个死循环,解决办法有两种,第一种是调大探测时间,第二种就是直接注释掉两个探针,我偷懒就直接注释了,pod是可以正常启动到,因为是不太重要的服务,所以无所谓,如果是业务pod,最好还是慢慢调试

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/808313
推荐阅读
相关标签
  

闽ICP备14008679号