kops k8s集群Kubectl命令超时问题

时间:2020-05-03 07:36:36

标签: kubernetes kubectl kops

我正在尝试跑步 k8s cluster的“ kubectl get nodes”命令显示“无法连接到服务器:拨打tcp ...” 这是由公司AWS帐户中的其他用户创建的k8s集群。 这是我遵循的步骤

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       

我需要查看k8集群中正在运行的节点和服务,我该怎么做。

1 个答案:

答案 0 :(得分:2)

可能的原因之一:路由/防火墙问题

在创建/使用私有集群时会发生。

要解决-在授权网络中添加外部IP

要获取您的外部IP地址,可以使用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

其他此类资源:

可能的原因二:丢失/陈旧的k8s上下文

要获取上下文,请使用:

kubectl config view 

要设置上下文,请使用:

kubectl config set-context <your_context>

可能的原因三:CF模板过时

根据this answer,您将检查创建集群时使用的AMI模板。

使用较旧版本的CloudFormation模板设置集群