Closed droopy4096 closed 2 weeks ago
redacted KUBECONFIG
:
apiVersion: v1
clusters:
- cluster:
server: https://kas.gitlab.com/k8s-proxy
name: gitlab
contexts:
- context:
cluster: gitlab
user: agent:62272
name: gitlab-org/distribution/infrastructure/kube-agents:buildx
current-context: gitlab-org/distribution/infrastructure/kube-agents:buildx
kind: Config
preferences: {}
users:
- name: agent:62272
user:
token: xxxxxx
downloading above KUBECONFIG
locally I can run kubectl
commands, however buildx
fails:
docker buildx create --use --name cngbuilder --platform=linux/amd64 --node=cngbuilder-amd64 --driver=kubernetes --driver-opt="namespace=default,nodeselector=kubernetes.io/arch=amd64"
cngbuilder
docker buildx create --append --name cngbuilder --platform=linux/arm64 --node=cngbuilder-arm64 --driver=kubernetes --driver-opt="namespace=default,nodeselector=kubernetes.io/arch=arm64"
cngbuilder
docker buildx inspect --bootstrap
resulting in:
[+] Building 0.1s (2/2) FINISHED
=> ERROR [cngbuilder-amd64 internal] booting buildkit 0.1s
=> ERROR [cngbuilder-arm64 internal] booting buildkit 0.1s
------
> [cngbuilder-amd64 internal] booting buildkit:
------
------
> [cngbuilder-arm64 internal] booting buildkit:
------
Name: cngbuilder
Driver: kubernetes
Last Activity: 2023-06-15 17:00:41 +0000 UTC
Nodes:
Name: cngbuilder-amd64
Endpoint: kubernetes:///cngbuilder?deployment=cngbuilder-amd64&kubeconfig=%2Fhome%2Fdroopy4096%2Ftmp%2Fbar%2Fkubeconfig
Driver Options: namespace="default" nodeselector="kubernetes.io/arch=amd64"
Status: inactive
Platforms: linux/amd64*
Name: cngbuilder-arm64
Endpoint: kubernetes:///cngbuilder?deployment=cngbuilder-arm64&kubeconfig=%2Fhome%2Fdroopy4096%2Ftmp%2Fbar%2Fkubeconfig
Driver Options: namespace="default" nodeselector="kubernetes.io/arch=arm64"
Status: inactive
Platforms: linux/arm64*
@droopy4096 Feel free to close this issue if https://github.com/docker/buildx/pull/1891 solves it.
Contributing guidelines
I've found a bug and checked that ...
Description
Using
buildx
with--driver=kubernetes
using GitLab Kubernetes Agent Server fails Authorization.Expected behaviour
Authorization should succeed given that
kubectl
commands within the same context perform as expected.Actual behaviour
While using
buildx
with--driver=kubernetes
from within GitLab pipelines attempting to utilize existing cluster I get:Buildx version
github.com/docker/buildx v0.10.5 86bdced
Docker info
No response
Builders list
Configuration
Build logs
No response
Additional info
Talking to GitLab KAS developers I've got this response:
so while it's difficult to troubleshoot immediately due to complexity of stack involved it does seem like there's a good chance
buildx
kubernetes driver strips portion of request resulting in above failures.More on the subject here: https://gitlab.com/gitlab-org/build/CNG/-/merge_requests/1368#note_1430995638 (including some logs etc.)