<p>I am doing some tutorials from <a href="https://codelabs.developers.google.com/codelabs/cloud-springboot-kubernetes?continue=https%3A%2F%2Fdevelopers.google.com%2Flearn%2Fpathways%2Fjava-cloud-fundamentals%23codelab-https%3A%2F%2Fcodelabs.developers.google.com%2Fcodelabs%2Fcloud-springboot-kubernetes#5" rel="nofollow noreferrer">https://codelabs.developers.google.com/codelabs/cloud-springboot-kubernetes?continue=https%3A%2F%2Fdevelopers.google.com%2Flearn%2Fpathways%2Fjava-cloud-fundamentals%23codelab-https%3A%2F%2Fcodelabs.developers.google.com%2Fcodelabs%2Fcloud-springboot-kubernetes#5</a>. I am using Google Cloud Console. When I type:</p>
<pre><code>kubectl version
</code></pre>
<p>I am getting an response:</p>
<pre><code>WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.  Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;27&quot;, GitVersion:&quot;v1.27.2&quot;, GitCommit:&quot;7f6f68fdabc4df88cfea2dcf9a19b2b830f1e647&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2023-05-17T14:20:07Z&quot;, GoVersion:&quot;go1.20.4&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
Kustomize Version: v5.0.1
Unable to connect to the server: dial tcp 34.135.56.138:443: i/o timeout
</code></pre>
<p>What I do not like is the</p>
<pre><code>Unable to connect to the server: dial tcp 34.135.56.138:443: i/o timeout
</code></pre>
<p>I am getting this error also when running other <strong>kubectl</strong> commands, which stops my progress.
I am using only out of the box tools provided by Google Cloud.
What is causing this error in Google Cloud Console? Do I need to make additional Kubernetes configuration? (The tutorial did not mention anything like that)</p>
<hr />
<p>Running the command as suggested in the comments:</p>
<pre><code>gcloud container clusters get-credentials hello-java-cluster --zone=us-central1-c
</code></pre>
<p>I am getting an error:</p>
<pre><code>Fetching cluster endpoint and auth data.
ERROR: (gcloud.container.clusters.get-credentials) ResponseError: code=404, message=Not found: projects/question-tracker/zones/us-central1-c/clusters/hello-java-cluster.
No cluster named 'hello-java-cluster' in question-tracker.
</code></pre>
<p>EDIT:
I have run the command: (instead of <strong>hello</strong>-java-cluster I ran it with previously created <strong>questy</strong>-java-cluster)</p>
<pre><code>(quizdev)$ gcloud container clusters get-credentials  questy-java-cluster --zone=us-central1-c
</code></pre>
<p>And it ran without error giving result:</p>
<pre><code>Fetching cluster endpoint and auth data.
kubeconfig entry generated for questy-java-cluster.
</code></pre>
<p>After this operation kubectl version runs in 1 second and does not give the error.</p>

fascynacja
<p>There are 2 steps that get blurred by <code>gcloud</code> into one.</p>
<p>The <a href="https://cloud.google.com/sdk/gcloud/reference/container/clusters/create" rel="nofollow noreferrer"><code>gcloud container clusters create</code></a> command not only creates the cluster but it also configures <code>kubectl</code> via kubeconfig (<code>~/.kube/config</code>) to access the cluster.</p>
<p>If you're unable to e.g. <code>kubectl get nodes</code> after <code>gcloud container clusters create</code> and you're confident the cluster created successfully (i.e. by checking Cloud Console), it may be that the kubeconfig file was not correctly configured.</p>
<p>Please confirm that the kubeconfig file in the default location (~/.kube/config) exists and contains data (<code>cluster</code>, <code>server</code>, <code>user</code>) entries correspondonging to your cluster.</p>
<p>If that all looks good, you can try repeating the step that configures kubeconfig: <a href="https://cloud.google.com/sdk/gcloud/reference/container/clusters/get-credentials" rel="nofollow noreferrer"><code>gcloud container clusters get-credentials hello-java-cluster --zone=us-central1-c</code></a>. If there are any other errors running these commands, please edit your question and include the errors.</p>
<p>If you've changed the cluster's <code>{NAME}</code>, <code>{LOCATION}</code> or are using a different Google Cloud <code>{PROJECT}</code>, please use these (replacing with the correct values) in the above command:</p>
<pre class="lang-bash prettyprint-override"><code>gcloud container clusters get-credentials ${NAME} \
--location=${LOCATION} \
--project=${PROJECT}
</code></pre>
