1

I referred many solutions yet no luck. I have a linux automation which runs few gcloud commands with some conditions. I made this script with node js, but it is incredibly slow that I even finish it manually before the scrips completes the run.

Same with the gcloud commands when I connect to a cluster and kubectl commands when i query something.

Please help!!

2 Answers2

0

It could be a DNS config error on WSL side. I hadthe same issue today, here's how I fixed it !

1. Checking the (deadly slow) response time

[tbg@~] time kubectl get deployments

No resources found in default namespace.

real    0m1.212s
user    0m0.151s
sys     0m0.050s

2. Checking the WSL/DNS configuration

[tbg@~]  cat /etc/wsl.conf

[network]
generateResolvConf=false
[tbg@~]  cat /etc/resolv.conf

nameserver XX.XXX.XXX.X
nameserver YYY.YY.YY.YY
nameserver 1.1.1.1

If you see that, remove these lines to get back to automatic resolv.conf generation and restart WSL (wsl --shutdown)

3. Checking the (fixed !) response time

[tbg@~] time kubectl get deployments

No resources found in default namespace.

real    0m10.530s
user    0m0.087s
sys     0m0.043s

I found out my resolv.conf configuration was causing that latency, by trying to reinstall kubectl with apt, and finding apt really slow too

TBG
  • 154
  • 4
  • 18
-1

Right now access to /mnt folders in WSL2 is too slow and by default at launch the entire Windows PATH is added to the Linux $PATH so any Linux binary that scans $PATH will make things unbearably slow.

To disable this feature, edit the /etc/wsl.conf to add the following section:

[interop]

appendWindowsPath = false

Avoid adding Windows Path to Linux $PATH and best for now is adding folders to the $PATH manually. Terminate the WSL distro (wsl.exe --terminate <distro_name>) to make it immediately effective or wsl.exe --shutdown and start the terminal again.

Refer to the stack link for more information.

Srividya
  • 1,678
  • 3
  • 10
  • I did try this already. I think I am missing this part "Avoid adding Windows Path to Linux $PATH and best for now is adding folders to the $PATH manually" What should we copy? Pls explain – Abilash Krishnan Sep 20 '22 at 07:49
  • Tried it, changed nothing. My PATH doesn't include any Windows element tho – TBG Feb 15 '23 at 13:40