无法连接到Kubernetes:服务器已要求客户端提供凭据



skaffold版本v1.35.1

正在使用本地注册表:KinD集群中的2。

kubectl config current-context>善良善良。和kubectl配置视图,显示kind-kind到服务器的正确url:127.0.0.1:57836

预期行为

在戈兰:云代码:Kubernetes-一个运行的例子

skaffold.yaml

# To learn more about the skaffold.yaml schema visit
# https://skaffold.dev/docs/references/yaml/
apiVersion: skaffold/v2beta19
kind: Config
build:
artifacts:
- context: .
image: go-hello-world
deploy:
kubectl:
manifests:
- kubernetes-manifests/**

实际行为

错误:

unable to connect to Kubernetes: the server has asked for the client to provide credentials

请注意,在以下内容中,它实际上是运行的,但只运行很短的时间。参见以下中的Step 8/14

skaffold-dev—默认回购localhost:5000

Listing files to watch...
- go-hello-world
Generating tags...
- go-hello-world -> 127.0.0.1:5000/go-hello-world:6b3fc6f-dirty
Checking cache...
- go-hello-world: Not found. Building
Starting build...
Found [kind-kind] context, using local docker daemon.
Building [go-hello-world]...
Sending build context to Docker daemon  932.9kB
Step 1/14 : FROM golang:1.16 as build
---> 5b838b7289de
Step 2/14 : WORKDIR /hello-world
---> Using cache
---> a8c93bc46b78
Step 3/14 : COPY go.mod go.sum ./
---> Using cache
---> cba8d38c5d62
Step 4/14 : RUN go mod download
---> Using cache
---> bfb3c3842a45
Step 5/14 : COPY . ./
---> f7f0547858d2
Step 6/14 : ARG SKAFFOLD_GO_GCFLAGS
---> Running in 8df9562291c8
---> 20aec50f0a84
Step 7/14 : RUN echo "Go gcflags: ${SKAFFOLD_GO_GCFLAGS}"
---> Running in f35f8060867a
Go gcflags: 
---> cc2532367c46
Step 8/14 : RUN go build -gcflags="${SKAFFOLD_GO_GCFLAGS}" -mod=readonly -v -o /app
---> Running in 03fe6cd6a195
hello-world
---> d8873c3d1844
Step 9/14 : FROM gcr.io/distroless/base
---> 64bbfbb81976
Step 10/14 : ENV GOTRACEBACK=single
---> Using cache
---> e7db9a53c2fe
Step 11/14 : WORKDIR /hello-world
---> Using cache
---> cba82d8b0927
Step 12/14 : COPY --from=build /app .
---> Using cache
---> fdd46a287814
Step 13/14 : COPY template ./template
---> Using cache
---> 01f1804abfcc
Step 14/14 : ENTRYPOINT ["./app"]
---> Using cache
---> c57d404bd28f
Successfully built c57d404bd28f
Successfully tagged 127.0.0.1:5000/go-hello-world:6b3fc6f-dirty
Tags used in deployment:
- go-hello-world -> 127.0.0.1:5000/go-hello-world:c57d404bd28fbee71266d45debb822dd57215b585c2e16f5b1b21b5632ee0904
Starting deploy...
Cleaning up...
unable to connect to Kubernetes: the server has asked for the client to provide credentials

使用--kubeconfig <path to kubeconfig file>运行skaffold应该很有用。

最新更新