smartechno
smartechno

Reputation: 490

kops k8s cluster Kubectl commands Timeout issue

I was trying to run "kubectl get nodes" command for k8s cluster.it gives "Unable to connect to the server: dial tcp..." this is a k8s cluster created by a different user in the company AWS account. this is the steps I have followed

export AWS_PROFILE=RR
export KOPS_STATE_STORE=s3://s3bucketname 
kops export kubecfg dev.k8s.local
kubectl config get-contexts      

kubectl get nodes                                                                                                                                                              12:53:18 
Unable to connect to the server: dial tcp 3.136.226.173:443: i/o timeout       

I need to view running nodes and services in this k8 cluster how can I do this.

Upvotes: 3

Views: 1013

Answers (1)

Yasen
Yasen

Reputation: 4474

Possible cause one: routing/firewall issues

It happens when you create/use private cluster.

To solve - add an external IP to authorized networks.

to get your external IP address, you can use some of these commands:

curl ifconfig.co
dig +short myip.opendns.com @resolver1.opendns.com

curl ifconfig.me
curl ifconfig.co
curl smart-ip.net/myip
wget -O - -q icanhazip.com
wget -O - -q ifconfig.me/ip

Other such resources:

Possible cause two: lost/stale k8s context

To get context use:

kubectl config view 

To set context use:

kubectl config set-context <your_context>

Possible cause three: outdated CF template

As per this answer, you'd check an AMI template that used when cluster was created.

The cluster was set up using an older version of the CloudFormation template

Upvotes: 2

Related Questions