Google Cloud SDK (gcloud) on cygwin - almost….

I work from a windows machine and install the Google Cloud SDK via the windows installer. I’m able to working in my cygwin environment for pretty much everything with a couple exceptions so far.

kubectl has some issues with the “cmd-path” configuration after authentication to a GKE cluster:

Unable to connect to the server: error executing access token command "/cygdrive/c/Users/brett/AppData/Local/Google/Cloud SDK/google-cloud-sdk/bin/gcloud config config-helper --format=json": err=exec: "/cygdrive/c/Users/brett/AppData/Local/Google/Cloud SDK/google-cloud-sdk/bin/gcloud": file does not exist output=

To address this after each successful gathering of endpoint and auth data I need to change the kubeconfig entry in ~/.kube/config:

- name: gke_ops-iac-sb_us-east1-b_iac-test-cluster
user:
auth-provider:
config:
cmd-args: config config-helper --format=json
cmd-path: /cygdrive/c/Users/brett/AppData/Local/Google/Cloud SDK/google-cloud-sdk/bin/gcloud
expiry-key: '{.credential.token_expiry}'
token-key: '{.credential.access_token}'
name: gcp

You can see the cmd-path points to my windows installed version of gcloud. (Note: I’ve tried this without spaces, in different directories and even pointed it to a location path under cygwin all with the same results.) This throws an error when doing anything with kubectl:

$ kubectl cluster-info
Unable to connect to the server: error executing access token command "/cygdrive/c/Users/brett/AppData/Local/Google/Cloud SDK/google-cloud-sdk/bin/gcloud config config-helper --format=json": err=exec: "/cygdrive/c/Users/brett/AppData/Local/Google/Cloud SDK/google-cloud-sdk/bin/gcloud": file does not exist output=

To fix this I change the cmd-path to:

cmd-path: gcloud

Problem is, everytime you authenticate this has to be done. I’ve also tried installing the cloud sdk using curl directly to cygwin. This works however I’m unable to install kubectl after:

$ gcloud components install kubectl
ERROR: (gcloud.components.install) The following components are unknown [kubectl].

I also can’t connect to pods:

$ kubectl.exe exec -it my-pod --namespace=my-namespace -- /bin/bash
Unable to use a TTY - input is not a terminal or the right kind of file

The next issue I ran into is around pushing docker images to Google Container Registry.

$ gcloud docker -- push gcr.io/ops-iac-sb/gcloud-slave:v1
The push refers to a repository [gcr.io/ops-iac-sb/gcloud-slave]
f2c2cdf1f2e9: Preparing
b5b8df85aa3c: Preparing
24b3e47367c1: Preparing
a75caa09eb1f: Preparing
9b790cee2175: Waiting
348667646bbd: Waiting

denied: Unable to access the repository; please check that you have permission to access it.

I haven’t found a workaround to this one yet. I have to run these commands from the windows Google Cloud SDK shell.

I love to be able to fully use the Google Cloud SDK from cygwin so I’ll keep poking at this. If anyone has any thoughts or has been more successful than me please let me know!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.