docker / compose-on-kubernetes

Deploy applications described in Compose onto Kubernetes clusters
Apache License 2.0
1.42k stars 159 forks source link

"invalid configuration: no configuration has been provided" error with microk8s #59

Closed neerolyte closed 3 years ago

neerolyte commented 5 years ago

I'm trying to get compose running with microk8s.

Originally I ran in to an error about .kube/config not being present:

$ docker stack deploy --orchestrator=kubernetes -c docker-compose.yml foo
stat /home/foo/.kube/config: no such file or directory

I was able to resolve that by asking kubectl to set a context name (this writes out a basic config file):

$ kubectl config set-context microk8s
Context "microk8s" created.

but then I get stuck on a less obvious error:

$ docker stack deploy --orchestrator=kubernetes -c docker-compose.yml foo
invalid configuration: no configuration has been provided

It'd be great if this error could give more context because it's unclear where it's coming from and what config is missing.

I can see with strace that docker itself is attempting to read a token file that's not present in my set up:

19480 execve("/usr/bin/docker", ["docker", "stack", "deploy", "--orchestrator=kubernetes", "-c", "docker-compose.yml", "foo"], 0x7ffc2ae6aea8 /* 65 vars */) = 0
[...]
19480 newfstatat(AT_FDCWD, "/var/run/secrets/kubernetes.io/serviceaccount/token", 0xc4202c32e8, 0) = -1 ENOENT (No such file or directory)
19480 write(2, "invalid configuration: no config"..., 58) = 58

I'm not clear what that token is actually for or how I'd tell docker where to find it.

P.s I originally logged this at https://github.com/moby/moby/issues/38602 as SEO guides me there - it'd be great to have a prominent guide for where to find bugs for the various docker projects.

simonferquel commented 5 years ago

kubectl config set-context creates an empty context with no configuration. It seems microk8s store its kubeconfig file in a non-default path. To create a kubeconfig file from the microk8s environment, you can do microk8s.kubectl config view --raw > $HOME/.kube/config (see https://github.com/ubuntu/microk8s#accessing-kubernetes)

neerolyte commented 5 years ago

Thanks you're right that does produce a better config file and lets me progress further.

neerolyte commented 5 years ago

I did get this working eventually, I'm going to try put together and submit a PR with notes to help the next person - having the original error explain more of what's gone wrong would still be helpful IMO, so I'm not closing this.

ijc commented 5 years ago

FWIW I agree that the message should be made clearer. I think (but am not sure) that this might actually be a docker/cli change.

chris-crone commented 3 years ago

Hi! Thanks for your feedback. Unfortunately we're no longer maintaining this repository so I will close this issue.