How to run consul via kubernetes?

6/15/2019

I tried running the pod (https://www.consul.io/docs/platform/k8s/run.html)

It failed with... containers with unready status: [consul]

kubectl create -f consul-pod.yml

apiVersion: v1
kind: Pod
metadata:
  name: consul-example
spec:
  containers:
    - name: example
      image: "consul:latest"
      env:
        - name: HOST_IP
          valueFrom:
            fieldRef:
              fieldPath: status.hostIP
      command:
        - "/bin/sh"
        - "-ec"
        - |
            export CONSUL_HTTP_ADDR="${HOST_IP}:8500"
            consul kv put hello world
  restartPolicy: Never
-- 001
consul
devops
kubernetes

0 Answers