前置条件

配置域名(可选)

address=/zipkin.basic.tanqidi.com/172.31.0.100
address=/zipkin.dev.tanqidi.com/172.31.0.100

1. docker 部署

docker run -d --name zipkin \
  --restart=always \
  -p 9411:9411 \
  -e STORAGE_TYPE=elasticsearch \
  -e ES_HOST=elasticsearch1.basic.tanqidi.com:9200 \
  openzipkin/zipkin:3.4.1

2. kubernetes 部署

2.1 deployment

kind: Deployment
apiVersion: apps/v1
metadata:
  name: zipkin
  namespace: basic
  labels:
    app: zipkin
  annotations:
    deployment.kubernetes.io/revision: '1'
    kubesphere.io/creator: admin
spec:
  replicas: 1
  selector:
    matchLabels:
      app: zipkin
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: zipkin
      annotations:
        kubesphere.io/creator: admin
        kubesphere.io/imagepullsecrets: '{}'
    spec:
      volumes:
        - name: host-time
          hostPath:
            path: /etc/localtime
            type: ''
      containers:
        - name: zipkin
          image: 'openzipkin/zipkin:3.4.1'
          ports:
            - name: http-9411
              containerPort: 9411
              protocol: TCP
          env:
            - name: STORAGE_TYPE
              value: elasticsearch
            - name: ES_HOST
              value: 'elasticsearch1.basic.tanqidi.com:9200'
          resources: {}
          volumeMounts:
            - name: host-time
              readOnly: true
              mountPath: /etc/localtime
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      serviceAccountName: default
      serviceAccount: default
      securityContext: {}
      schedulerName: default-scheduler
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 25%
      maxSurge: 25%
  revisionHistoryLimit: 10
  progressDeadlineSeconds: 600

2.2 service

使用NodePort来试验访问

kind: Service
apiVersion: v1
metadata:
  name: zipkin
  namespace: basic
  labels:
    app: zipkin
  annotations:
    kubesphere.io/creator: admin
spec:
  ports:
    - name: http-9411
      protocol: TCP
      port: 9411
      targetPort: 9411
      nodePort: 31676
  selector:
    app: zipkin
  type: NodePort
  sessionAffinity: None
  externalTrafficPolicy: Cluster
  ipFamilies:
    - IPv4
  ipFamilyPolicy: SingleStack
  internalTrafficPolicy: Cluster

2.2 coredns

rewrite name zipkin.basic.tanqidi.com zipkin.basic.svc.cluster.local

图片-bftu.png