Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Network connection problems in Google Cloud SDK while I have access to google or website like google app engine in my browser

I created an account on Google App Engine, then I installed google-cloud-sdk by gcloud init, and get the following error:

Pick configuration to use:
 [1] Re-initialize this configuration [a] with new settings
 [2] Create a new configuration
 [3] Switch to and re-initialize existing configuration: [default]
Please enter your numeric choice:  1

Your current configuration has been set to: [a]

You can skip diagnostics next time by using the following flag:
  gcloud init --skip-diagnostics

Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.
ERROR: Reachability Check failed.
    Cannot reach https://www.google.com (ResponseNotReady)
    Cannot reach https://accounts.google.com (ResponseNotReady)
    Cannot reach 
https://cloudresourcemanager.googleapis.com/v1beta1/projects 
(ResponseNotReady)
    Cannot reach https://www.googleapis.com/auth/cloud-platform 
(ResponseNotReady)
Network connection problems may be due to proxy or firewall settings.

Do you have a network proxy you would like to set in gcloud (Y/n)?  Y

Select the proxy type:
 [1] HTTP
 [2] HTTP_NO_TUNNEL
 [3] SOCKS4
 [4] SOCKS5
Please enter your numeric choice:  1

Enter the proxy host address: XXX

Enter the proxy port: XXX

Is your proxy authenticated (y/N)?  n

Cloud SDK proxy properties set.

Rechecking network connection...done.
ERROR: Reachability Check still does not pass.
    Cannot reach https://www.google.com (ResponseNotReady)
    Cannot reach https://accounts.google.com (ResponseNotReady)
    Cannot reach 
https://cloudresourcemanager.googleapis.com/v1beta1/projects 
(ResponseNotReady)
    Cannot reach https://www.googleapis.com/auth/cloud-platform 
(ResponseNotReady)
    Cannot reach 
https://dl.google.com/dl/cloudsdk/channels/rapid/components-2.json 
(ResponseNotReady)

Current effective Cloud SDK network proxy settings:
    type = http
    host = XXX
    port = XXX
    username = None
    password = None

What would you like to do?
 [1] Change Cloud SDK network proxy properties
 [2] Clear all gcloud proxy properties
 [3] Exit
Please enter your numeric choice:

I am in China but I can unblock google or website like google app engine in my browser with proxy(setting in shadowsocks2.3). I tried to set a network proxy in google cloud SDK, the IP address and port are exactly the one used in shadowsocks2.3, but it still didn’t work. And my project list couldn’t be accessed. What is the exact problem? Hints or explanations are all appreciated. Many thanks in advance!

like image 820
Xue Guo Avatar asked Apr 01 '18 07:04

Xue Guo


1 Answers

You need to configure your gcloud cli tool to use a proxy.

https://cloud.google.com/sdk/docs/proxy-settings

In my case, I'm using shadow-socks as proxy, so I did:

gcloud config set proxy/type socks5
gcloud config set proxy/address 127.0.0.1
gcloud config set proxy/port 1086

and it works.

like image 110
jxw1102 Avatar answered Sep 23 '22 21:09

jxw1102