Kubenetes gcloud container engine get-credential error - google-app-engine

I am trying to connect Google Container Engine from my local machine using gcloud sdk but i am getting below error.
C:\Program Files (x86)\Google\Cloud SDK>gcloud container clusters get-credential
s cluster-2 --zone us-central1-a --project myapp-00000
Fetching cluster endpoint and auth data.
ERROR: (gcloud.container.clusters.get-credentials) environment variable HOME or
KUBECONFIG must be set to store credentials for kubectl
I have check at HOME location there is not .kube folder created and not environment variable set by default, so i have created KUBECONFIG environment by myself after that i am getting below error :-
ERROR: gcloud crashed (OSError): [Errno 13] Permission denied: 'C:\\Tool\\config'
i have started gcloud sdk as admin and it have all the correct Permission.
EDIT
I am using below version (which are latest as of today)
Google Cloud SDK 129.0.0
kubectl
kubectl-windows-x86_64 1.4.0
C:\Program Files (x86)\Google\Cloud SDK>kubectl version
Client Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.0",

I take it you set KUBECONFIG env to 'C:\Tool\config'? That error is gcloud failing to write due to missing admin privileges; I don't know if you need to run the shell as admin. You might also try the HOME directory. Note that gcloud will attempt to create any missing directories on the path to the kubeconfig file.

I had the same issue.
It turns out that KUBECONFIG refers to a file and not to a directory.
So if you set up KUBECONFIG to 'C:\Tool\config\kubectl.cfg' it should work fine.

Related

App Engine Deploy: credentials file not writable. ... Opening in read-only mode. ... Any refreshed credentials will only be valid for this run

I recently upgraded my cloud SDK, and now I can no longer deploy to app engine flexible. I deploy my app with the following command:
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\gcloud.cmd preview app deploy --promote vm.yaml
I am getting get the following output and crash (abridged):
WARNING: Could not acquire lock C:\Users\Michael\AppData\Roaming\gcloud\credentials.lock in 0 seconds
WARNING: The credentials file (C:\Users\Michael\AppData\Roaming\gcloud\credentials) is not writable. Opening in read-only mode. Any refreshed credentials will only be valid for this run.
WARNING: Could not acquire lock C:\Users\Michael\AppData\Roaming\gcloud\credentials.lock in 0 seconds
WARNING: The credentials file (C:\Users\Michael\AppData\Roaming\gcloud\credentials) is not writable. Opening in read-only mode. Any refreshed credentials will only be valid for this run.
WARNING: Could not acquire lock C:\Users\Michael\AppData\Roaming\gcloud\credentials.lock in 0 seconds
WARNING: The credentials file (C:\Users\Michael\AppData\Roaming\gcloud\credentials) is not writable. Opening in read-only mode. Any refreshed credentials will only be valid for this run.
...
ERROR: gcloud crashed (OSError): [Errno 13] Permission denied: 'C:\\Users\\Michael\\AppData\\Roaming\\gcloud\\credentials.lock'
If you would like to report this issue, please run the following command:
gcloud feedback
Below is some of the output from gcloud feedback
Trace:
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\gcloud_main.py:171
gcloud_cli.Execute()
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\calliope\cli.py:719
result = args.calliope_command.Run(cli=s...
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\calliope\backend.py:1404
resources = command_instance.Run(args)
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\surface\app\deploy.py:91
return deploy_util.RunDeploy(self, args,...
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\command_lib\app\deploy_util.py:206
service, code_bucket_ref)
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\api_lib\app\deploy_app_command_util.py:233
_UploadFiles(files_to_upload, bucket_ref...
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\api_lib\app\deploy_app_command_util.py:175
results = pool.map(_UploadFile, tasks)
c:\Python27\lib\multiprocessing\pool.py:251
return self.map_async(func, iterable, ch...
c:\Python27\lib\multiprocessing\pool.py:567
raise self._value
OSError: [Errno 13] Permission denied: 'C:\\Users\\Michael\\AppData\\Roaming\\gcloud\\credentials.lock'
Installation information:
Google Cloud SDK [120.0.0]
Platform: [Windows, x86_64]
Python Version: [2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)]]
Python Location: [c:\Python27\python.exe]
[output truncated]
Any ideas?
This is a bug with the Google SDK's parallel upload feature introduced in June 2016. Work-around the bug by turning off the feature with the following command:
gcloud config set app/num_file_upload_processes 1
The command above limits the number of parallel uploads to 1 thread/process, so they don't step on each other's feet.
I recently had the same issue. Go to the directory shown in the error message. You'd find two credientials files. Delete the one with the LOCK extension( it would be the empty one). Then redeploy your project. Worked perfectly for me.
I've also ran into this issue as well. How it happened --> I ran gcloud app deploy command, but later realised that the deployment took much longer to finish (perhaps hanging), then I killed the batch process i.e. CTRL +C. When I reissued the command thats when I got into this issue. So the SOLUTION, do what's already said above i.e. go and delete the credentials.lock file (in my case it found in C:\Users\Sam\AppData\Roaming\gcloud directory)
The better way is to solve this error is to reinstall after deleting the root directory where lock file is.

Managed VM Deployment hangs on "Copying certificates for secure access..."

I'm running the following command to deploy my Managed VMs app (on Windows 10):
gcloud preview app deploy app.yaml --project=<PROJECT> --promote
The deployment starts bug hangs on the following line:
Copying certificates for secure access. You may be prompted to create an SSH keypair.
And after some time I get the error:
ERROR: (gcloud.preview.app.deploy) Unable to copy certificates.
I've already:
Made sure that there are SSH keys in ~\.ssh\google_compute_engine
Tried to run with --quiet - same results
Renamed ssh-term.exe to ssh.exe - same results
Run the command as an administrator.
Run the command with --verbosity debug, which prints the following line multiple times: DEBUG: File [f] does not exist locally.
Any help will be much appreciated!
Found the cause! It was the project's firewall that blocked SSH by default. Fixed that and it worked.
Glad you fixed it, I had the same problem and will use your fix. I did happen accros a work around. By using the Container Build API to perform the build.
enter the command
gcloud config set app/use_cloud_build true
Before you
gcloud preview app deploy
Cite: https://github.com/isusanin/google-cloud-sdk/issues/533

Deploying an app on Google App Engine path to certificate not provided error

For the past few days I have been trying to trace the source of the error shown in the blockquote in trying to deploy an app to google app engine on a windows machine using the command:
> gcloud preview app deploy app.yaml
Beginning deployment... Verifying that Managed VMs are enabled and
ready.
Traceback (most recent call last): ...
File "C:\Program Files\Google\Cloud
SDK\google-cloud-sdk\bin.../lib\docker\docker\tls.py", line 46, in
init
'Path to a certificate and key files must be provided'
TLSParameterError: Path to a certificate and key files must be
provided through the client_config param. TLS configurations should
map the Docker CLI client configurations.
Does anyone have any idea on how to solve this issue?
FYI: I have already set the environment variables DOCKER_CERT_PATH, DOCKER_TLS_VERIFY and DOCKER_HOST as set by Docker.

Trouble with Google appengine id

I successfully launched an app locally on the local host
When I deployed to the appengine I got an error.
com.google.appengine.tools.admin.HttpIoException: Error posting to URL: https://appengine.google.com/api/appversion/create?app_id=my_id&version=1&
404 Not Found
This application does not exist (app_id=u'my_id').
For some reason the ID given in the error has u and a space appended in the beginning
I doubled checked the application exists and succesfuly uploaded the app from another computer
All the solutions I can find (like "This application does not exist (app_id=xxx)", or "GAE - Deployment Error: “AttributeError: can't set attribute”") mention running appcfg.py with the --no_cookies
C:\Program Files (x86)\Google\google_appengine\appcfg.py
appcfg.py --no_cookies update my-app-folder\
# or (2-steps verificatio enabled)
appcfg.py --oauth2 --no_cookies update my-app-folder\
If the project contains Java7 classes, you need to add the --use_java7 option, as shown in the question "Failed to deploy to Google App Engine because --use_java7 flag has not been set".
While you can run appcfg from the GAE installation path, the page "Using the Google Plugin for Eclipse" mentions (at the bottom of the page):
Some features of the App Engine Java SDK tools are only available by running the tools directly from the command line. If you have installed the SDK using Eclipse, you can run these tools from the Eclipse plugin installation directory.
The SDK is located in your Eclipse installation directory, under plugins/com.google.appengine.eclipse.sdkbundle_VERSION/, where VERSION is a version identifier for the SDK.
In this directory is the appengine-java-sdk/bin/ subdirectory containing the tools.

Running appcfg.py

I have python + google app engine installed on a windows XP machine. Google App engine is installed in the default directory of python25.
How do I run appcfg.py from command line?
I tried running it after changing directory to python25 but I get an error that the program is not a valid win32.exe
I also tried running it directly from c:\program files\google\google_appengine but I also get an error.
Secondly, I need to run appcfg with the rollback option. How do I do this?
Thanks
you needs to assign python scripts to python.exe or do the following [Path to Python]\python.exe [Path to appcfg]\appcfg.py rollback [path to app].

Resources