我遵循了本教程:Kubernetes Cluster with private networking on AWS using Kops
但是,在创建 kubernetes 集群后,我收到以下错误:
$ kops validate cluster
Using cluster from kubectl context: k8s-cluster.mydomain.com
Validating cluster k8s-cluster.mydomain.com
错误信息:
unexpected error during validation: error listing nodes: Get https://subdomain.eu-central-1.elb.amazonaws.com/api/v1/nodes: EOF
有关如何调试或解决此问题的任何想法?
我用来创建的步骤如下:
设置 VPC 和子网
创建 VPC
$ aws ec2 create-vpc --cidr-block 10.0.0.0/16 --region eu-central-1
允许 DNS 主机名
$ aws ec2 modify-vpc-attribute --vpc-id ${VPC_ID} --enable-dns-hostnames "{\"Value\":true}" --region ${REGION}
创建互联网网关
$ aws ec2 create-internet-gateway --region ${REGION}
将 Internet 网关连接到 VPC
$ aws ec2 attach-internet-gateway --internet-gateway-id ${INTERNET_GATEWAY_ID} --vpc-id ${VPC_ID} --region ${REGION}
[公共(public)子网] 创建三个公共(public)区域/子网 (3x)
$ aws ec2 create-subnet --vpc-id ${VPC_ID} --cidr-block 10.0.0.0/20 --availability-zone ${AVAILABILITY_ZONE_1} --region ${REGION}
将公有子网设置为将公有 IP 自动分配给实例 (3x)
$ aws ec2 modify-subnet-attribute --subnet-id ${PUBLIC_SUBNET_1} --map-public-ip-on-launch --region ${REGION}
[PRIVATE SUBNETS] 创建三个私有(private)区域/子网 (3x)
$ aws ec2 create-subnet --vpc-id ${VPC_ID} --cidr-block 10.0.48.0/20 --availability-zone ${AVAILABILITY_ZONE_1} --region ${REGION}
[设置 NAT 网关] 分配地址 (3x)
$ aws ec2 allocate-address --domain vpc --region ${REGION}
为公共(public)区域创建 NAT 网关 (3x)
$ aws ec2 create-nat-gateway --subnet-id ${PUBLIC_SUBNET_1} --allocation-id ${EIP_ALLOCATION_ID_1} --region ${REGION}
[配置路由表] 创建路由表
$ aws ec2 create-route-table --vpc-id ${VPC_ID} --region ${REGION}
为互联网网关创建路由
$ aws ec2 create-route --route-table-id ${RTB_PUBLIC_1} --destination-cidr-block 0.0.0.0/0 --gateway-id ${INTERNET_GATEWAY_ID} --region ${REGION}
将公有子网与路由表关联 (3x)
$ aws ec2 associate-route-table --route-table-id ${RTB_PUBLIC_1} --subnet-id ${PUBLIC_SUBNET_1} --region ${REGION}
[ROUTE TABLE FOR PRIVATE ZONES] 为每个私有(private)区域创建路由表 (3x)
$ aws ec2 create-route-table --vpc-id ${VPC_ID} --region ${REGION}
创建到 NAT 网关的路由 (3x)
$ aws ec2 create-route --route-table-id ${RTB_PRIVATE_1} --destination-cidr-block 0.0.0.0/0 --nat-gateway-id ${NAT_GW_1} --region ${REGION}
关联子网 (3x)
$ aws ec2 associate-route-table --route-table-id ${RTB_PRIVATE_1} --subnet-id ${PRIVATE_SUBNET_1} --region ${REGION}
其他配置
将 S3 存储桶设置为 Kops 状态存储
$ aws s3api create-bucket --bucket my-state-store --region ${REGION} --create-bucket-configuration LocationConstraint=eu-central-1
创建集群
$ kops create cluster --node-count 3 --zones ${AVAILABILITY_ZONE_1},${AVAILABILITY_ZONE_2},${AVAILABILITY_ZONE_3} --master-zones ${AVAILABILITY_ZONE_1},${AVAILABILITY_ZONE_2},${AVAILABILITY_ZONE_3} --state ${KOPS_STATE_STORE} --dns-zone=${DNS_ZONE_PRIVATE_ID} --dns private --node-size m5.large --master-size m5.large --topology private --networking weave --vpc=${VPC_ID} --bastion ${NAME}
编辑集群以配置子网
$ kops edit cluster ${NAME}
注意:更新子网以与上面创建的公共(public)/私有(private)子网相对应
$ kops update cluster ${NAME} --yes
最佳答案
问题解决了。它不是 kops
问题,问题出在 AWS M5 和 linux 版本上。
The kops default Debian jessie images do not support nvme for EBS volumes, which is used by the AWS M5 instance types. As a result, masters fail to start, as they can not mount the EBS volumes.
来源:https://github.com/kubernetes/kops/issues/4873
关于amazon-web-services - KOPS:在 AWS VPC 上具有私有(private)网络的 Kubernetes 集群:错误列出节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52287584/