Storeconfig executable not found (k8s deployment object)

Okay, I am spiking out a POC to migrate our traefik default ingress controller to HA using consul as a backend. I have consul up and running in a test namespace and am at the point where I want to use the storeconfig command to put our traefik.toml values into the kv store the easy way... However, as soon as the pod starts it dies with this error:
Error: failed to start container "traefik-consul-test": Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"storeconfig\": executable file not found in $PATH": unknown

I am using the :1.7.12-alpine image and below is the relevant specs of my deployment object, I've left out the volumes, env vars, and other sensitive info:

kind: Deployment
metadata:
  labels:
    k8s-app: traefik-consul-test
  name: traefik-consul-test
  namespace: consul-test
spec:
  template:
    metadata:
      labels:
        k8s-app: traefik-consul-test
    spec:
      containers:
      - name: traefik-consul-test
        args:
        - "--consul --consul.endpoint=consul-test-consul-server-0:8500"
        command: 
        - "storeconfig"
        image: traefik:1.7.12-alpine

Any insight would make my week.

The alpine container requires the command in the format:
traefik storeconfig --consul....

The official traefik container is FROM: scratch, so the traefik command is not required.

1 Like

So, I just figured out the alpine image wants the traefik command as well, but pushed out the deployment with that in the command like so:

kind: Deployment
metadata:
  labels:
    k8s-app: traefik-consul-test
  name: traefik-consul-test
  namespace: consul-test
spec:
  template:
    metadata:
      labels:
        k8s-app: traefik-consul-test
    spec:
      containers:
      - name: traefik-consul-test
        # args:
        # - "--consul --consul.endpoint=consul-test-consul-server-0:8500"
        command: 
        - "traefik storeconfig --consul --consul.endpoint=consul-test-consul-server-0:8500"
        image: traefik:1.7.12-alpine

and got this back still: Error: failed to start container "traefik-consul-test": Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"traefik storeconfig --consul --consul.endpoint=consul-test-consul-server-0:8500\": executable file not found in $PATH": unknown

Funny thing is that I can kubectl run -i --tty traefik image=traefik:1.7.12-alpine -- sh and run the command from within the shell just fine, which I suppose satisfies my needs, but doesn’t answer the question.

Okay, you’re still my fave, but I am still hitting the same error…
Error: failed to start container "traefik-consul-test": Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"storeconfig\": executable file not found in $PATH": unknown
^ that was using traefik:1.7.12 without the traefik command. Tried it just as you have configured above on the alpine image… Same error.

Can you try one more config?

spec:
      containers:
      - name: traefik-consul-test
        args:
        - "storeconfig"
        - "--consul"
        - "--consul.endpoint=consul-test-consul-server-0:8500"
        command: 
        - "traefik"
         image: traefik:1.7.12-alpine

Absolutely happy to. I’ll post the results in a sec.

It works!

2019/06/28 19:11:17 Storing configuration: {"LifeCycle":{"RequestAcceptGraceTimeout":0,"GraceTimeOut":10000000000},"GraceTimeOut":0,"Debug":false,"CheckNewVersion":true,"SendAnonymousUsage":false,"AccessLogsFile":. 

To be clear, it’s having a hard time connecting to consul still - but at least we have the k8s deployment manifest commands working. I can handle the networking side on my own.

And this one works for using the traefik:1.7.12 image:

    spec:
      containers:
      - name: traefik-ha
        args:
        - "storeconfig"
        - "--consul"
        - "--consul.endpoint=<your-consul-endpoint>:8500"
        image: traefik:1.7.12

Thank you so much Daniel, you’re a consistent source of joy in my life.

It’s so beautiful: :drooling_face: