Getting Consul and Registrator to work in Kubernetes

2/5/2017

I'm trying to use Consul with Registrator in GCE & K8s. Everything launches fine except `Registrator'.

Here is my deployment:

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: {}

Here are the log outputs: Consul: enter image description here Registrator: enter image description here

In docker-compose everything works fine, but I haven't got my head completeley around K8s and GCE. Thanks for the help!

-- Tino
consul
google-cloud-platform
kubernetes
registrator

1 Answer

2/7/2017

I have switched to Linkerd which works very well together with k8s.

-- Tino
Source: StackOverflow