让领事和Registrator在Kubernetes工作

时间:2017-02-05 14:01:00

标签: kubernetes google-cloud-platform consul registrator

我正在尝试将ConsulRegistrator一起用于GCE& K8S。一切都很好,除了“Registrator”。

这是我的部署:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  creationTimestamp: null
  name: consul
spec:
  replicas: 1
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        service: consul
    spec:
      restartPolicy: Always
      containers:
        - name: consul
          image: eu.gcr.io/xxx/consul
          ports:
          - containerPort: 8300
            protocol: TCP
          - containerPort: 8400
            protocol: TCP
          - containerPort: 8500
            protocol: TCP
          - containerPort: 53
            protocol: UDP
          env:
            - name: MY_POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
          args:
            - -server
            - -bootstrap
            - -advertise=$(MY_POD_IP)

        - name: registrator
          args:
            - -internal
            - -ip=$(MY_POD_IP)
            - consul://localhost:8500
          env:
            - name: MY_POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
          image: eu.gcr.io/xxx/registrator
          volumeMounts:
            - mountPath: /tmp/docker.sock
              name: registrator-claim0
      volumes:
        - name: registrator-claim0 
          persistentVolumeClaim:
            claimName: registrator-claim0
status: {}

以下是日志输出: 领事: enter image description here Registrator: enter image description here

在docker-compose中一切正常,但我还没有完全围绕K8s和GCE。谢谢你的帮助!

1 个答案:

答案 0 :(得分:1)

我已经切换到Linkerd,它与k8s一起工作得非常好。