Home > Back-end >  kubectl Unexpected error when reading response body
kubectl Unexpected error when reading response body

Time:09-16

Update: this is a network issue. Nothing to do with the software stack.

I have a k8s cluster running in another, not-so-secure network, and I am obviously using kubeconfig.

I can do all other stuff, just not kubectl apply -f.

The problem is I get - when kubectl apply -f <file>:

    kubectl  E0914 18:43:57.731039    4053 request.go:1085] Unexpected error when reading response body: context deadline exceeded (Client.Timeout or context cancellation while reading body)
error: unexpected error when reading response body. Please retry. Original error: context deadline exceeded (Client.Timeout or context cancellation while reading body)

Do you know what to do?

kubectl version
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.  Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.0", GitCommit:"a866cbe2e5bbaa01cfd5e969aa3e033f3282a8a2", GitTreeState:"clean", BuildDate:"2022-08-23T17:36:43Z", GoVersion:"go1.19", Compiler:"gc", Platform:"darwin/arm64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.0", GitCommit:"a866cbe2e5bbaa01cfd5e969aa3e033f3282a8a2", GitTreeState:"clean", BuildDate:"2022-08-23T17:38:15Z", GoVersion:"go1.19", Compiler:"gc", Platform:"linux/arm64"}

CodePudding user response:

It's maybe a network issue. have you tried using request-timeout option in your command?

kubectl apply -f <file> --request-timeout=4s 

From the documentation:

--request-timeout string     Default: "0"

The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests.

CodePudding user response:

This is a network issue, and has nothing to do with the software stack. I found out as other issues started to show up in my network.

  • Related