简体   繁体   English

在AWS托管的kubernetes集群中的KOPS部署主节点上拒绝连接

[英]Connection refused on KOPS deployed master node in kubernetes cluster hosted on AWS

I'm doing a little R&D on Kubernetes and deploying clusters on AWS. 我正在Kubernetes上进行一些研发,并在AWS上部署集群。 I'm using KOPS to do the heavy lifting and provisioning the cluster with Terraform. 我正在使用KOPS进行繁重的工作,并使用Terraform来配置群集。

My goal is testing the behavior of Kubernetes when a port that is essential to a particular service has been blocked on a node hosting pods provide the service. 我的目标是在托管Pod的节点上阻止特定服务必不可少的端口时,测试Kubernetes的行为。 To do so, I wanted to ssh into my master node and manually block the port on a worker. 为此,我想使用ssh进入主节点并手动阻塞工作服务器上的端口。

I've been running the following command : 我一直在运行以下命令:

ssh -i ~/.ssh/id_rsa admin@<master_ip>

only to have the following response 只得到以下回应

ssh: connect to host <master_ip> port 22: Connection refused

This is the command that I've been using to create my cluster : 这是我用来创建集群的命令:

kops create cluster \
--name=${KOPS_NAME} \
--state=${KOPS_STATE_STORE} \
--zones=eu-central-1a,eu-central-1b,eu-central-1c \
--master-zones=eu-central-1a,eu-central-1b,eu-central-1c  \
--node-count=5 \
--node-size=t2.micro \
--master-size=t2.micro \ 
--ssh-public-key=~/.ssh/id_rsa.pub \
--out=. \
--target=terraform

The security groups on AWS, in which my masters are enrolled, allow traffic on the port 22 and running a 在其中注册了我的管理员的AWS安全组允许端口22上的流量并运行

kops describe secret admin

shows that there is a public key attributed to the admin user. 显示存在归因于admin用户的公共密钥。

I do not think this is a bug, as there is no one else that seems to have this problem on the KOPS git, and, while I am far from an expert in AWS, it would seem odd to me that this is a problem with AWS. 我不认为这是一个错误,因为在KOPS git上似乎没有其他人出现此问题,尽管我距离AWS专家还很远,但我觉得这很奇怪AWS。

EDIT 编辑

$> ssh -i ~/.ssh/id_rsa <adress>.elb.amazon.com -vvv
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug2: resolving "<address>.elb.amazonaws.com" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to <address>.elb.amazonaws.com [ip address] port 22.

Use can use a --bastion flag while provisioning cluster. 在配置群集时,使用可以使用--bastion标志。 Then use the bastion host to ssh into master. 然后使用堡垒主机将ssh转换为master。 This approach has been working for us. 这种方法一直在为我们工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM