Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcloud update fails without sudo #85

Closed
atinylittleshell opened this issue Apr 16, 2016 · 4 comments
Closed

gcloud update fails without sudo #85

atinylittleshell opened this issue Apr 16, 2016 · 4 comments

Comments

@atinylittleshell
Copy link

In https://circleci.com/docs/google-cloud-platform/ and https://circleci.com/docs/google-auth/ there are a couple of places where the example suggested running
gcloud components update

this won't succeed without sudo.

ERROR: (gcloud.components.update) You cannot perform this action because you do not have permission to modify the Google Cloud SDK installation directory [/opt/google-cloud-sdk].

Re-run the command with sudo: sudo /opt/google-cloud-sdk/bin/gcloud ...

gcloud --quiet components update kubectl returned exit code 1

Action failed: gcloud --quiet components update kubectl

the correct example should be:
sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update

@atinylittleshell
Copy link
Author

No wait.. even sudo won't work. Everything started to fail after running gcloud components update with sudo.

@FelicianoTech
Copy link
Contributor

Your original assertion was correct. Using sudo and the full path is the way to use it, ran into this issue myself on an upcoming guide. We'll need to update the docs you pointed out.

What is the new error you're getting with updating?

@atinylittleshell
Copy link
Author

I ended up doing the following:

#!/bin/bash
sudo -E env "PATH=$PATH" gcloud --quiet components update kubectl
sudo chmod 757 /home/ubuntu/.config/gcloud/logs -R

gcloud auth activate-service-account --key-file ./my/key.json
gcloud config set project $GCLOUD_PROJECTID
gcloud container clusters get-credentials my-cluster \
  --project=$GCLOUD_PROJECTID --zone=$CLOUDSDK_COMPUTE_ZONE

It's really weird that "gcloud container clusters get-credentials" couldn't read the environment variables correctly and requires us to manually specify --project and --zone. but once specified, this is working. kubectl can work fine after these commands.

@FelicianoTech
Copy link
Contributor

@kunchenguid Once again, thanks for pointing this out. I was aware of the need to use sudo and the entire path but didn't realize the gcloud binary also has trouble with environment variables.

Docs has been updated to reflect using the long, unwieldy command while we investigate getting the command to work the way it should from within the image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants