<p>I executed followign command</p>
<pre><code>gcloud container clusters get-credentials my-noice-cluter --region=asia-south2
</code></pre>
<p>and that command runs successfully. I can see the relevant config with <code>kubectl config view</code></p>
<p>But when I try to kubectl, I get timeout</p>
<p>kubectl config view</p>
<pre><code>❯ kubectl get pods -A -o wide
Unable to connect to the server: dial tcp &lt;some noice ip&gt;:443: i/o timeout
</code></pre>
<p>If I create a VM in gcp and use kubectl there or use gcp's cloud shell, It works but it does not work on our local laptops and PCs.</p>
<p>Some network info about our cluster:-</p>
<pre><code>Private cluster     Disabled    
Network     default 
Subnet  default 
VPC-native traffic routing  Enabled     
Pod address range   10.122.128.0/17     
Service address range   10.123.0.0/22   
Intranode visibility    Enabled     
NodeLocal DNSCache  Enabled     
HTTP Load Balancing     Enabled     
Subsetting for L4 Internal Load Balancers   Disabled    
Control plane authorized networks   
office (192.169.1.0/24)
    
Network policy  Disabled    
Dataplane V2    Disabled
</code></pre>
<p>I also have firewall riles to allow http/s</p>
<pre><code>❯ gcloud compute firewall-rules list
NAME                                       NETWORK  DIRECTION  PRIORITY  ALLOW                         DENY  DISABLED
default-allow-http                         default  INGRESS    1000      tcp:80                              False
default-allow-https                        default  INGRESS    1000      tcp:443                             False
....
</code></pre>

LightSith
<p>If it's work from your VPC and not from outside, it's because you created a <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters" rel="nofollow noreferrer">private GKE cluster</a>. The master is only reachable through the private IP or through the autorized network.</p>
<p>Speaking about the <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/authorized-networks" rel="nofollow noreferrer">authorized network</a>, you have one authorizer <code>office (192.169.1.0/24)</code>. Sadly, you registered a private IP range in your office network and not the public IP used to access the internet.</p>
<p>To solve that, go to a site that provide you your public IP. Then update the authorized network for your cluster with that IP/32, and try again.</p>
