zipkin-server

在服务器根目录下,创建 zipkin-server.yaml 文件,文件内容为:

---
kind: ConfigMap
apiVersion: v1
metadata:
  name: zipkin-cm
  annotations:
    kubesphere.io/creator: admin
data:
  # mem,cassandra3,mysql,elasticsearch
  zipkin.db.adapter: mysql
  zipkin.db.host: '192.168.3.20'
  zipkin.db.port: '3306'
  zipkin.db.database: zipkin_db
  zipkin.db.username: zipkin
  zipkin.db.password: zipkin
  zipkin.rabbit.addresses: '192.168.3.20:5672'
  zipkin.rabbit.username: admin
  zipkin.rabbit.password: admin
  zipkin.es.host: 'http://10.22.0.130:9200'
  zipkin.kafka.zookeeper: '10.22.0.130:2181'
  zipkin.kafka.bootstrap.servers: '192.168.3.20:9092'
  zipkin.cassandra.ensure.schema: false
  zipkin.cassandra.contact.points: '192.168.3.20:9092'
  zipkin.cassandra.username: cassandra
  zipkin.cassandra.password: cassandra
---
apiVersion: v1
kind: Service
metadata:
  name: zipkin-svc
  annotations:
    kubesphere.io/alias-name: Zipkin服务链路追踪
    kubesphere.io/description: Zipkin服务链路追踪
spec:
  ports:
    - name: tcp-9411
      port: 9411
      protocol: TCP
      targetPort: 9411
  selector:
    app: zipkin
  type: NodePort
---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: zipkin-deploy
  annotations:
    kubesphere.io/alias-name: Zipkin服务链路追踪
    kubesphere.io/description: Zipkin服务链路追踪
spec:
  replicas: 1
  selector:
    matchLabels:
      app: zipkin
  template:
    metadata:
      labels:
        app: zipkin
    spec:
      containers:
        - name: zipkin
          image: 'openzipkin/zipkin'
          ports:
            - containerPort: 9411
              protocol: TCP
          env:
            - name: STORAGE_TYPE
              valueFrom:
                configMapKeyRef:
                  name: zipkin-cm
                  key: zipkin.db.adapter
            - name: MYSQL_HOST
              valueFrom:
                configMapKeyRef:
                  name: zipkin-cm
                  key: zipkin.db.host
            - name: MYSQL_TCP_PORT
              valueFrom:
                configMapKeyRef:
                  name: zipkin-cm
                  key: zipkin.db.port
            - name: MYSQL_DB
              valueFrom:
                configMapKeyRef:
                  name: zipkin-cm
                  key: zipkin.db.database
            - name: MYSQL_USER
              valueFrom:
                configMapKeyRef:
                  name: zipkin-cm
                  key: zipkin.db.username
            - name: MYSQL_PASS
              valueFrom:
                configMapKeyRef:
                  name: zipkin-cm
                  key: zipkin.db.password
            - name: RABBIT_ADDRESSES
              valueFrom:
                configMapKeyRef:
                  name: zipkin-cm
                  key: zipkin.rabbit.addresses
            - name: RABBIT_USER
              valueFrom:
                configMapKeyRef:
                  name: zipkin-cm
                  key: zipkin.rabbit.username
            - name: RABBIT_PASSWORD
              valueFrom:
                configMapKeyRef:
                  name: zipkin-cm
                  key: zipkin.rabbit.password
            - name: ES_HOSTS
              valueFrom:
                configMapKeyRef:
                  name: zipkin-cm
                  key: zipkin.es.host
            - name: KAFKA_ZOOKEEPER
              valueFrom:
                configMapKeyRef:
                  name: zipkin-cm
                  key: zipkin.kafka.zookeeper
            - name: KAFKA_BOOTSTRAP_SERVERS
              valueFrom:
                configMapKeyRef:
                  name: zipkin-cm
                  key: zipkin.kafka.bootstrap.servers
            - name: CASSANDRA_ENSURE_SCHEMA
              valueFrom:
                configMapKeyRef:
                  name: zipkin-cm
                  key: zipkin.cassandra.ensure.schema
            - name: CASSANDRA_CONTACT_POINTS
              valueFrom:
                configMapKeyRef:
                  name: zipkin-cm
                  key: zipkin.cassandra.contact.points
            - name: CASSANDRA_USERNAME
              valueFrom:
                configMapKeyRef:
                  name: zipkin-cm
                  key: zipkin.cassandra.username
            - name: CASSANDRA_PASSWORD
              valueFrom:
                configMapKeyRef:
                  name: zipkin-cm
                  key: zipkin.cassandra.password
          imagePullPolicy: Always

使用 kubectl 执行如下命令部署 zipkin-server 服务 :

kubectl apply -f zipkin-server.yaml --namespace=你的命名空间

kubectl apply -f zipkin-server.yaml --namespace=ops-prod

作者:Jeebiz  创建时间:2023-03-16 11:21
最后编辑:Jeebiz  更新时间:2023-03-20 16:51