kubectl commands takes lot of time execute and freezing entire system

Viewed 191

when ever I run a kubectl command, it takes a lot of time to execute, mostly > 1 minute and some time between 40seconds to 1 minute. However, during this execution time, the entire system freeze if I use keyboard to switch between applications (clicking with trackpad has no impact luckily) and I cannot perform any other action, like a mouse click or switch between applications unless the command executes.

Is there a way to speed up? I've done a time analysis using the time command on zsh + mac.

Using gcloud 386.0, and installed kubectl components using gcloud, below is the outcome.

$ time kubectl get pods -n my-name-space

NAME                                              READY   STATUS             RESTARTS   AGE
abc-svc-84699b749c-sgc5n                          2/2     Running            0          4h2m
def-7b6c594798-mtsqd                              2/2     Running            17         13d
pqr-call-69bb7c5d4b-64twc                         2/2     Running            0          3h45m

kubectl get pods -n my-name-space  0.54s user 0.52s system 0% cpu 1:59.29 total

Observing the total time, it took almost 2 minutes.

1 Answers

Finally I was able to consistently get under 40 seconds of response time. I feel this is some what consistent and better compared to > 2 minutes, > 90 seconds response time.

I added the below to my ~/.config/gcloud/configurations/config-xxx files and then generated the kubectl config

[container]
cluster = dev // replace dev with your cluster name
Related