Unable to initialize gcloud environment - google-compute-engine

I have google cloud sdk installed on my ubuntu 14.4system but whenever I type gcloud init in my console, I get the following error:-
rbenv: gcloud: command not found
Further if I run gcloud init with sudo the error changes to:-
/usr/bin/env: ruby1.9.1: No such file or directory
I am unable to understand what has google cloud sdk to do with rbenv. I tried reinstalling google cloud sdk but with the same result. Is there a way out? any help is greatly appreciated.

On linux when you install the SDK it prompts to put following into your ~/.bashrc so PATH and such are setup to make cmds like gcloud visible
# The next line updates PATH for the Google Cloud SDK.
source '/home/scott/google-cloud-sdk/path.bash.inc'
# The next line enables shell command completion for gcloud.
source '/home/scott/google-cloud-sdk/completion.bash.inc'
If you are not on linux/OSX then the SDK install will have similar

It sounds as though gcloud is not on your $PATH.
If you installed the Cloud SDK to /home/username/google-cloud-sdk/, you should be able to invoke gcloud by running /home/username/google-cloud-sdk/bin/gcloud info. If you would like to be able to run simply gcloud, you can run export PATH="/home/username/google-cloud-sdk/bin:$PATH" (to make this setting persist, put that command in your ~/.profile file.

Related

The Command Prompt is not recognizing http

I'm trying to install the Google App Engine.
I have Cloud SDK v260.0.0 and Python 2.7.9
When I run the command:
http://code.google.com/appengine/gcloud components install app-engine-python from the cmd
it gives me the error:
'http:' is not recognized as an internal or external command,
operable program or batch file.
What is going on?
I have Windows 10 and I'm running from the Directory:
C:\Users\MyName\AppData\Local\Google\Cloud SDK
Here is the Guide to install app engine for Python 2.
Since you mentioned that Python and Google Cloud SDK have been installed, you might start from step 3 to run the following command in your terminal for the gcloud component:
gcloud components install app-engine-python
As Yanan C stated you install app engine with:
gcloud components install app-engine-python
However, I had to remove the link in the beginning.
Change:
http://code.google.com/appengine/gcloud components install app-engine-python
To:
gcloud components install app-engine-python

How do I make gcloud work on opensuse 13.2 in Google Cloud?

I spin up an instance with opensuse 13.2 (x86_64 built on 2015-05-11) in Google Cloud, ssh to the instance, try to run gcloud and get following error:
evgeny#tea-2:~> gcloud
python: can't open file '/usr/bin/../lib/google/cloud/sdk/gcloud/gcloud.py': [Errno 2] No such file or directory
How do I make it work?
Sounds like a bug of some sort. Can try reinstalling it? Try running:
curl https://sdk.cloud.google.com | bash
then log out and log back in
You can pull gcloud directly from Google as shown in Answer #1 or you can use the packaged version from the openSUSE repositories.
After logging in via ssh:
~> sudo -i
# zypper ar -t rpm-md -n 'Cloud Tools Devel' http://download.opensuse.org/repositories/Cloud:/Tools/openSUSE_13.2/ cloud_tools_devel
# zypper install google-cloud-sdk-0.9.44-13.2.noarch
You will need to accept the build key for the new repository that was added.

kubectl is not installed on GCE by default

Following the guide I'm trying to manage Google Container Engine cluster from another machine on Google Compute Engine. Here is the output from my GCE instance:
oleksandr_berezianskyi_gmail_com#docker-managed-jenkins:~$ sudo gcloud components update preview
All components are up to date.
oleksandr_berezianskyi_gmail_com#docker-managed-jenkins:~$ sudo gcloud components update alpha
All components are up to date.
oleksandr_berezianskyi_gmail_com#docker-managed-jenkins:~$ gcloud alpha container kubectl create -f cassandra.yaml
ERROR: (gcloud.alpha.container.kubectl) This command requires the kubernetes client (kubectl), which is installed with the gcloud preview component. Run 'gcloud components update preview', or make sure kubectl is installed somewhere on your
path.
As you see my Google Cloud SDK seems to be up-to-date but still not working properly on GCE. Is there something I'm missing?
The correct way to install kubectl is now gcloud components install kubectl
You must have the Google Cloud SDK installed
For further information, Quick Start Guide
If you have run gcloud components update that will install the kubectl binary on your system, it just won't be in your path. It will be located in the cloud-sdk install directory. You can add it to your path manually by running
export PATH=$PATH:/usr/local/share/google/google-cloud-sdk/bin/
or you can create a symlink from a directory that is already in your path, like /usr/local/bin by running
sudo ln -s /usr/local/share/google/google-cloud-sdk/bin/kubectl /usr/local/bin/kubectl
You can download the current version of the kubectl binary from this Google Cloud Storage URL: https://storage.googleapis.com/kubernetes-release/release/v0.18.2/bin/linux/amd64/kubectl
As of (at least) 138.0.0 (Nov 2016)
It's now gcloud components install kubectl
This is when running:
Your current Cloud SDK version is: 138.0.0
Here are the related instructions:
To install or remove components at your current SDK version [138.0.0], run:
$ gcloud components install COMPONENT_ID
$ gcloud components remove COMPONENT_ID
To update your SDK installation to the latest version [141.0.0], run:
$ gcloud components update
System Version: macOS 13.1 (22C65)
Chip: Apple M1
ProductVersion: 13.1
export PATH=$PATH:/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/
helped me

Openshift asks to change permission of file to 600 on Windows

while executing rhc setup i got following error
Your private SSH key file should be set as readable only to yourself. Please run CHMOD 600 C:/user/myuser/.ssh/id_rsa
Now how can i execute such command on windows.
However, I tried to use git bash. But have not got any success.!!
You can execute Linux commands on windows machine using Cygwin.
There are a couple of more tools using which you can do the same but I found Cygwin great!!!

Unable to run gcutil from command line

When I try to install gcutil by following steps on https://developers.google.com/compute/docs/gcutil/
here is the bin dir contents of C:\gcutil\google-cloud-sdk\bin :
but gcutil does not seem to install correctly. When I attempt to run gcutil I receive the error :
C:\gcutil\google-cloud-sdk\bin>gcutil
'gcutil' is not recognized as an internal or external command,
operable program or batch file.
Should gcutil not be a .bat file command ? How can I invoke gcutil ?
You do not need to install cygwin unless you need the ssh functionality of gcutil.
The reason you could not initially run gcutil is because it was a python script (and you were not prefixing the command with 'python'). We have since changed this to be a .cmd script, so it should work more natively in windows. If you add the bin directory to your PATH, you should be able to run gcutil from anywhere.
Download and install Cygwin. Install the 32-bit version.
Start Cygwin. and download the SDK
$ curl https://dl.google.com/dl/cloudsdk/release/install_google_cloud_sdk.bash | bash
Restart Cygwin (or cmd).
Authenticate.
$ gcloud auth login
Reset PATH from console.
setx PATH "%PATH%;C:\full\path\to\google-cloud-sdk\bin"
Or you can use environment variables.
About variables
Installing cygwin to run gcutil if you are working with windows.
https://developers.google.com/compute/docs/gcutil/ (check the windows tab)
I just do it and work fine.