GKE unable to connect to the server: dial tcp server_ip: i/o timeout

Every time I run a command in the kubernetes cluster I get the following error message: unable to connect to the server: dial tcp server_ip: i/o timeout

I’ve already followed the step by step to try to solve the problem described here: https://cloud.google.com/kubernetes-engine/docs/troubleshooting#kubectl-times-out, but it didn’t solve the problem

Has anyone had this problem?

I ran the command kubectl get nodes -v=10 to try to see more information about the error, but the return only shows a timeout command output

in this image I’m inside the cluster

in my case what I need to do is update some resources using kubectl apply -f my_file.yaml

New contributor

Pedro Henrique is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

First, could you please let me know where you are running the commands from? Is it a cloud shell, local machine, or a VM instance?

There are multiple scenarios that can cause this error depending on the cluster environments. Some of the frequently occurring scenarios include:

  • kubectl is unable to communicate with the cluster control plane or does not exist.
  • The source IP is not allowed in the ‘Control plane authorized networks’ configuration of the cluster.

Based on your post, I assume you have added the Control Plane authorized networks. However, there’s a possibility that the GKE cluster context is not correctly configured on the source machine.
Ex: The GKE cluster context or the endpoint IP is incorrect on the kube config file ($HOME/.kube/config).

To resolve this issue, verify the context where the cluster is set: Navigate to $HOME/.kube/config or execute the command kubectl config view to ensure the configuration file contains the correct cluster context and the external IP address of the control plane.

Example to view the current/active cluster context used by kubectl command and verify the cluster endpoint IP.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>kubectl config view --minify
</code>
<code>kubectl config view --minify </code>
kubectl config view --minify

After checking the config file, If there is something wrong with the current context like invalid IP, you might want to recreate it by using the following gcloud command.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>gcloud container clusters get-credentials <CLUSTER_NAME> --region=<COMPUTE_REGION> --project=<PROJECT_ID>
</code>
<code>gcloud container clusters get-credentials <CLUSTER_NAME> --region=<COMPUTE_REGION> --project=<PROJECT_ID> </code>
gcloud container clusters get-credentials <CLUSTER_NAME>  --region=<COMPUTE_REGION> --project=<PROJECT_ID>

Replace the following:

CLUSTER_NAME: the name of your cluster.

COMPUTE_REGION: the Compute Engine region for your cluster. For zonal clusters, use –zone=COMPUTE_ZONE.

PROJECT_ID: the ID of the project in which the GKE cluster was created

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật