1

When I type gcloud container clusters get-credentials, I get response entry generated for ***.. and it looks like it is generated, but when I hit kubectl config view, there is nothing.

Reference of gcloud container clusters get-credentials says,

gcloud container clusters get-credentials updates a kubeconfig file with appropriate credentials and endpoint information to point kubectl at a specific cluster in Google Kubernetes Engine.

So I thought the problem was that ~/.kube/config did not exist, but creating an empty file did not change it.

The command gcloud container clusters get-credentials will not create a kubeconfig.

iwatachan
  • 159
  • 2
  • 8
  • Please try the `gcloud container get-credentials` with `--verbosity=debug`. I wonder whether `gcloud` is unable (not permitted) to write to `${HOME}` perhaps `${HOME}/.kube`. perhaps check `ls -la` on both for ownership? – DazWilkin Dec 10 '21 at 02:54
  • Perhaps and/or with `--log-http` to confirm that the underlying calls are succeeding (though I suspect they are) and it's a local issue – DazWilkin Dec 10 '21 at 02:56
  • I think `kubectl config view` is defaulting to null values because it's unable to find `~/.kube/config` – DazWilkin Dec 10 '21 at 02:57
  • 1
    It was due to a rudimentary mistake regarding the WSL, Sorry... The verbosity flag helped me. Thanks. – iwatachan Dec 10 '21 at 10:44

1 Answers1

0

The reason was that the PATH of WSL included the PATH of the Windows side by default, so it was calling the gcloud on Windows (installed by scoop). I solved the problem by excluding the PATH of Windows, referring to this gists.

iwatachan
  • 159
  • 2
  • 8