Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubeconfig not used #1697

Closed
3 tasks done
maitredede opened this issue Mar 27, 2023 · 2 comments
Closed
3 tasks done

Kubeconfig not used #1697

maitredede opened this issue Mar 27, 2023 · 2 comments

Comments

@maitredede
Copy link

Contributing guidelines

I've found a bug and checked that ...

  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

Using buildx plugin v0.10.4, I am using a gitlab CI task to create a kubernetes builder. The kubernetes config file is at default place : /root/.kube/config in runner task. It is properly used (kubectl get nodes is ok).

When I want to create a builder docker buildx create --bootstrap --driver=kubernetes [...] I have an error User "system:anonymous" cannot get resource "deployments" in API group "apps" in the namespace "gitlab-ci".

I also tried to set env var KUBECONFIG, but it does not change the behavior.

It may be related to #1676

Expected behaviour

The builder creation command docker buildx create --bootstrap --driver=kubernetes [...] should work.

I have downgraded to v0.9.1, it works :

Actual behaviour

Error User "system:anonymous" cannot get resource "deployments" in API group "apps" in the namespace "gitlab-ci".
Tested with :

Buildx version

github.com/docker/buildx v0.10.4 c513d34

Docker info

No response

Builders list

Builder not yet created

Configuration

docker buildx create --name=mybuilder --platform=linux/amd64 --node=amd64


### Logs

_No response_

### Additional info

_No response_
@maitredede
Copy link
Author

Based on #1676,

buildx/builder/node.go

Lines 80 to 89 in 4a73abf

kcc, err = ctxkube.ConfigFromContext(n.Endpoint, contextStore)
if err != nil {
// err is returned if n.Endpoint is non-context name like "unix:///var/run/docker.sock".
// try again with name="default".
// FIXME(@AkihiroSuda): n should retain real context name.
kcc, err = ctxkube.ConfigFromContext("default", contextStore)
if err != nil {
logrus.Error(err)
}
}
:

I have tried with a custom version of buildx with logging, and the error is pretty disapointing :

context "kubernetes:///ci-job-513721-nomarch?deployment=ci-job-513721-nomarch-amd64&kubeconfig=%2Froot%2F.kube%2Fconfig": context not found: open /root/.docker/contexts/meta/23abaa6b4bdd98bdf9056a5529007b5d3303031a61dff0664eca9aadc18d5e7e/meta.json: no such file or directory

@crazy-max
Copy link
Member

@maitredede This should be fixed since 0.11.2 (#1957)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants