[BUG] `make open-dev-container` fails during Kind setup with API connection refused

未关闭
#3,667 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
bash, docker, kubernetes

调研方向

The failure comes from the create-kind-cluster Makefile target (around Makefile line 415), which runs scripts/kind/setup-kind.sh with KIND_KUBECONFIG_SERVER_HOST=host.docker.internal set. The kubectl call is contacting https://127.0.0.1 on a random port, so start by checking how setup-kind.sh writes the kubeconfig server address and whether it matches the devcontainer's network. Done means the post-create command finishes after the cluster is created and its resources are applied, and make open-dev-container exits 0 on a Linux Docker host.

由索引模型根据 Issue 内容生成。

描述

📋 Prerequisites
  • I have searched the existing issues to avoid creating a duplicate
  • By submitting this issue, you agree to follow our Code of Conduct
  • I am using the latest version of the software
  • I have tried to clear cache/cookies or used incognito mode (if ui-related)
  • I can consistently reproduce this issue
🎯 Affected Service(s)

Not Sure

🚦 Impact/Severity

Minor inconvenience

🐛 Bug Description

Starting the devcontainer creates the Kind cluster and reports the control plane ready, but cluster setup then fails when kubectl tries to contact the Kubernetes API. The devcontainer command exits with an error instead of completing setup.

🔄 Steps To Reproduce
  1. On a Linux host with Docker and the repository's devcontainer tooling installed, run make open-dev-container.
  2. Allow the devcontainer image to build and the Kind cluster to start.
  3. Observe the post-create command fail during cluster setup.
🤔 Expected Behavior

The post-create command should finish successfully after creating the Kind cluster and applying its setup resources.

📱 Actual Behavior

The Kind cluster reports ready, but the subsequent API request is refused. The post-create command and make open-dev-container exit with status 2 and 1, respectively.

💻 Environment
  • Host OS: Fedora Linux 45 (Workstation Edition)
  • Kernel: Linux 7.2.15-300.fc45.x86_64
  • Container runtime: Docker 29.9.3
  • Dev Containers CLI: 0.90.0
  • Kind: 0.27.0 (devcontainer image)
  • Kubernetes node image: kindest/node:v1.35.0
  • GNU Make: 4.4.1
  • Host Node.js: 26.13.0 (nvm 0.40.8)
🔧 CLI Bug Report

No response

🔍 Additional Context

This failed on the first attempted run. No workarounds were attempted.

📋 Logs
user@fedora:~/repos/kagent$ make open-dev-container 
make: /^go / { print $2 }: No such file or directory
Building and starting dev container...
devcontainer up --workspace-folder .
[7 ms] @devcontainers/cli 0.90.0. Node.js v26.13.0. linux 7.2.15-300.fc45.x86_64 x64.
[2211 ms] Resolving Feature dependencies for 'ghcr.io/devcontainers/features/docker-outside-of-docker:1'...
[3101 ms] Soft-dependency 'ghcr.io/devcontainers/features/common-utils' is not required.  Removing from installation order...
[3508 ms] Files to omit: ''
[3539 ms] Start: Run: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-user/container-features/0.90.0-1794532076020/Dockerfile-with-features -t vsc-kagent-08dc100df2bc0392955534bfc5d7f4d8c7083079c9486a3c5892184be7681c93 --target dev_containers_target_stage --build-arg TOOLS_GO_VERSION=1.27.3 --build-arg TOOLS_NODE_VERSION=24.13.0 --build-arg TOOLS_UV_VERSION=0.10.4 --build-arg TOOLS_K9S_VERSION=0.50.4 --build-arg TOOLS_KIND_VERSION=0.27.0 --build-arg TOOLS_ISTIO_VERSION=1.26.0 --build-arg TOOLS_ARGO_CD_VERSION=v1.8.4 --build-arg TOOLS_KUBECTL_VERSION=1.35.0 --build-arg TOOLS_GRPCURL_VERSION=1.9.3 --build-context dev_containers_feature_content_source=/tmp/devcontainercli-user/container-features/0.90.0-1794532076020 --build-arg _DEV_CONTAINERS_BASE_IMAGE=tools-node-python-golang --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp /home/user/repos/kagent/.devcontainer
[+] Building 2.1s (28/28) FINISHED                                          docker:default
 => [internal] load build definition from Dockerfile-with-features                    0.0s
 => => transferring dockerfile: 8.95kB                                                0.0s
 => [internal] load metadata for ghcr.io/astral-sh/uv:0.10.4-debian-slim              0.7s
 => [context dev_containers_feature_content_source] load .dockerignore                0.0s
 => => transferring dev_containers_feature_content_source: 2B                         0.0s
 => [internal] load .dockerignore                                                     0.0s
 => => transferring context: 2B                                                       0.0s
 => [context dev_containers_feature_content_source] load from client                  0.1s
 => => transferring dev_containers_feature_content_source: 46.02kB                    0.0s
 => [base-os 1/2] FROM ghcr.io/astral-sh/uv:0.10.4-debian-slim@sha256:b852203fd78319  0.1s
 => => resolve ghcr.io/astral-sh/uv:0.10.4-debian-slim@sha256:b852203fd7831954c58bfa  0.1s
 => [context dev_containers_feature_content_source] load from client                  0.1s
 => => transferring dev_containers_feature_content_source: 157B                       0.0s
 => CACHED [base-os 2/2] RUN mkdir -p /etc/apt/keyrings     && apt-get update && apt  0.0s
 => CACHED [base 1/2] RUN uv python install 3.12                                      0.0s
 => CACHED [base 2/2] RUN mkdir -p  /usr/local/nvm     && curl https://raw.githubuse  0.0s
 => CACHED [builder 1/1] RUN apt-get update && apt-get install -y --no-install-recom  0.0s
 => CACHED [node-python-golang 1/1] RUN --mount=type=cache,target=/cache,rw     wget  0.0s
 => CACHED [tools-node-python-golang 1/9] RUN curl -o /usr/local/bin/kubectl-argo-ro  0.0s
 => CACHED [tools-node-python-golang 2/9] RUN curl -fsSL -o get_helm.sh https://raw.  0.0s
 => CACHED [tools-node-python-golang 3/9] RUN curl -L https://istio.io/downloadIstio  0.0s
 => CACHED [tools-node-python-golang 4/9] RUN curl -Lo ./kind https://kind.sigs.k8s.  0.0s
 => CACHED [tools-node-python-golang 5/9] RUN curl -LO https://github.com/derailed/k  0.0s
 => CACHED [tools-node-python-golang 6/9] RUN curl -Lo /usr/local/bin/kubectl "https  0.0s
 => CACHED [tools-node-python-golang 7/9] RUN go install github.com/fullstorydev/grp  0.0s
 => CACHED [tools-node-python-golang 8/9] RUN sh -c "$(wget https://raw.githubuserco  0.0s
 => CACHED [tools-node-python-golang 9/9] RUN curl -fsSL https://claude.ai/install.s  0.0s
 => CACHED [dev_containers_target_stage 1/4] RUN mkdir -p /tmp/dev-container-feature  0.0s
 => CACHED [dev_containers_feature_content_normalize 1/2] COPY --from=dev_containers  0.0s
 => CACHED [dev_containers_feature_content_normalize 2/2] RUN chmod -R 0755 /tmp/bui  0.0s
 => CACHED [dev_containers_target_stage 2/4] COPY --from=dev_containers_feature_cont  0.0s
 => CACHED [dev_containers_target_stage 3/4] RUN echo "_CONTAINER_USER_HOME=$( (comm  0.0s
 => CACHED [dev_containers_target_stage 4/4] RUN --mount=type=bind,from=dev_containe  0.0s
 => exporting to image                                                                1.0s
 => => exporting layers                                                               0.0s
 => => preparing layers for inline cache                                              0.8s
 => => exporting manifest sha256:3ec47c09b79c6565a0dcc1036d35a7f91a2f858c7980ef80838  0.0s
 => => exporting config sha256:f3bb6c849b7172480878586f807bd0a46a261a38c0f58cfb06055  0.0s
 => => exporting attestation manifest sha256:7fdc87a860956cf9a966d04d1282cf621a57356  0.0s
 => => exporting manifest list sha256:68944163cb19b767f3ca5461bedefeb8dd19e03d70a57c  0.0s
 => => naming to docker.io/library/vsc-kagent-08dc100df2bc0392955534bfc5d7f4d8c70830  0.0s
 => => unpacking to docker.io/library/vsc-kagent-08dc100df2bc0392955534bfc5d7f4d8c70  0.0s
[6006 ms] Start: Run: docker run --sig-proxy=false -a STDOUT -a STDERR --mount type=bind,source=/home/user/repos/kagent,target=/workspaces/kagent --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker-host.sock --mount source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind -l devcontainer.local_folder=/home/user/repos/kagent -l devcontainer.config_file=/home/user/repos/kagent/.devcontainer/devcontainer.json --security-opt label=disable --entrypoint /bin/sh vsc-kagent-08dc100df2bc0392955534bfc5d7f4d8c7083079c9486a3c5892184be7681c93 -c echo Container started
Container started
Running the postCreateCommand from devcontainer.json...

fatal: detected dubious ownership in repository at '/workspaces/kagent'
To add an exception for this directory, call:

        git config --global --add safe.directory /workspaces/kagent
make: /^go / { print $2 }: No such file or directory
CONTAINER_RUNTIME=docker KIND_CLUSTER_NAME=kagent KIND_IMAGE_VERSION=1.35.0 bash ./scripts/kind/setup-kind.sh
ba667c9b867236a532cf9a7544f037cee92c1773762cc94b2eae88e9b1cff7bf
No kind clusters found.
using docker due to KIND_EXPERIMENTAL_PROVIDER
Creating cluster "kagent" ...
 ✓ Ensuring node image (kindest/node:v1.35.0) 🖼 
 ✓ Preparing nodes 📦  
 ✓ Writing configuration 📜 
 ✓ Starting control-plane 🕹️ 
 ✓ Installing CNI 🔌 
 ✓ Installing StorageClass 💾 
 ✓ Waiting ≤ 1m0s for control-plane = Ready ⏳ 
 • Ready after 17s 💚
Set kubectl context to "kind-kagent"
You can now use your cluster with:

kubectl cluster-info --context kind-kagent

Have a nice day! 👋
using docker due to KIND_EXPERIMENTAL_PROVIDER
error: error validating "STDIN": error validating data: failed to download openapi: Get "https://127.0.0.1:39155/openapi/v2?timeout=32s": dial tcp 127.0.0.1:39155: connect: connection refused; if you choose to ignore these errors, turn validation off with --validate=false
make: *** [Makefile:415: create-kind-cluster] Error 1
[41588 ms] postCreateCommand from devcontainer.json failed with exit code 2. Skipping any further user-provided commands.
Error: Command failed: /bin/sh -c KIND_KUBECONFIG_SERVER_HOST=host.docker.internal make create-kind-cluster
    at Q (/home/user/.nvm/versions/node/v26.13.0/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:237:157)
    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
    at async Promise.allSettled (index 0)
    at async Aj (/home/user/.nvm/versions/node/v26.13.0/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:239:119)
    at async Ld (/home/user/.nvm/versions/node/v26.13.0/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:228:4668)
    at async Md (/home/user/.nvm/versions/node/v26.13.0/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:228:4013)
    at async Nd (/home/user/.nvm/versions/node/v26.13.0/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:228:3217)
    at async rg (/home/user/.nvm/versions/node/v26.13.0/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:228:2623)
    at async KW (/home/user/.nvm/versions/node/v26.13.0/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:473:1550)
    at async PL (/home/user/.nvm/versions/node/v26.13.0/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:473:984)
{"outcome":"error","message":"Command failed: /bin/sh -c KIND_KUBECONFIG_SERVER_HOST=host.docker.internal make create-kind-cluster","description":"postCreateCommand from devcontainer.json failed.","containerId":"5866dbe7e5628745eaad4a9c90bba127bf6a12b2e2e70e76d6cf70a0eb975015"}
make: *** [Makefile:663: open-dev-container] Error 1
📷 Screenshots

No response

🙋 Are you willing to contribute?
  • I am willing to submit a PR to fix this issue
主要语言
Go
星标
4.5k
派生
937
平均合并
1 天 10 小时
30 天内合并 PR
150

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

kagent-dev/kagent 的其他 Issue

查看 kagent-dev/kagent 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。