【问题标题】:Unable to create cluster with Kops command无法使用 Kops 命令创建集群
【发布时间】:2020-03-01 00:28:09
【问题描述】:

我在使用 kops 命令创建 k8 集群时遇到问题。

这是我在尝试创建集群时遇到的错误。

W1104 16:31:41.803150   18534 apply_cluster.go:945] **unable to pre-create DNS records - cluster startup may be slower: Error pre-creating DNS records: InvalidChangeBatch**: [RRSet with DNS name api.dev.devops.com. is not permitted in zone uswest2.dev.devops.com., RRSet with DNS name api.internal.dev.devops.com. is not permitted in zone uswest2.dev.devops.com.]

我用来创建集群的命令:

kops create cluster --cloud=aws --zones=us-west-2b --name=dev.devops.com --dns-zone=uswest2.dev.devops.com --dns private

kops update cluster --name dev.devops.com --yes

谁能帮帮我。提前致谢!!

【问题讨论】:

  • 我尝试使用 kops 创建集群。你能分享aws route53 list-hosted-zones-by-name 的输出吗?如果您尝试使用--dns-zone=dev.devops.com,您会得到同样的错误吗?
  • ubuntu@K8-management-server:~$ aws route53 list-hosted-zones-by-name { "HostedZones": [ { "ResourceRecordSetCount": 2, "CallerReference": "****-AC78-B9F0-A056-********1B", "Config": { "PrivateZone": true }, "Id": "/hostedzone/**********MA781O3", "Name": "uswest2.dev.devops.com." } ], "IsTruncated": false, "MaxItems": "100" }
  • 当我使用 --dns-zone=dev.devops.com W1106 21:57:49.025751 22867 executor.go:130] 运行任务“IAMRolePolicy/masters.dev”时遇到错误.devops.com”(距离成功还剩 9 分 59 秒):错误渲染 PolicyDocument:错误打开资源:DNS ZoneID 未设置 W1106 21:57:49.026066 22867 executor.go:130] 错误运行任务“IAMRolePolicy/nodes.dev.devops.com "(距离成功还剩 9 分 59 秒):错误渲染 PolicyDocument:错误打开资源:未设置 DNS ZoneID

标签: kubernetes devops kops


【解决方案1】:

您已将您的dns-zone 注册为uswest2.dev.devops.com,并且您在命令中引用的名称为dev.devops.com

如果你查看this docs,尤其是Configure DNS部分,你会发现:

在这种情况下,您希望将所有 Kubernetes 记录包含在一个 您在 Route53 中托管的域的子域。这需要创建一个 route53 中的第二个托管区域,然后设置路由委托到 新区域。

在本例中,您拥有 example.com 和您的 Kubernetes 记录 看起来像 etcd-us-east-1c.internal.clustername.subdomain.example.com

您会发现基于此文档示例: etcd-us-east-1c.internal.clustername.subdomain.example.com 您的 dev.devops.com 是域,uswest2.dev.devops.com 是您的子域。

Route 53 文档中,您将能够找到示例,在这种情况下example.org 的子域设置为kopsclustertest

export ID=$(uuidgen)
echo $ID
ae852c68-78b3-41af-85ee-997fc470fd1c

aws route53 \
create-hosted-zone \
--output=json \
--name kopsclustertest.example.org \
--caller-reference $ID | \
jq .DelegationSet.NameServers

[
  "ns-1383.awsdns-44.org",
  "ns-829.awsdns-39.net",
  "ns-346.awsdns-43.com",
  "ns-1973.awsdns-54.co.uk"
]

此时: 子域: kopsclustertest 域名: example.org

您会在下面的几章中找到KOPS CLUSTER CREATION部分。

kops create cluster \
--cloud=aws \
--master-zones=us-east-1a,us-east-1b,us-east-1c \
--zones=us-east-1a,us-east-1b,us-east-1c \
--node-count=2 \
--node-size=t2.micro \
--master-size=t2.micro \
${NAME}

有信息

环境变量 ${NAME} 之前是用我们的 集群名称:mycluster01.kopsclustertest.example.org

表示subdomain.domain之前需要指定你的集群名称。

简而言之,在标志 --name 中,您必须指定: <your_cluster_name>.subdomain.domain

请尝试:

kops create cluster --cloud=aws --zones=us-west-2b --name=my-cluster.uswest2.dev.devops.com --dns-zone=uswest2.dev.devops.com --dns private

【讨论】:

  • 嗨 @PjoterS.. 非常感谢您的帮助..您提供的命令有效,再次感谢您解释 DNS 和 Route 53
  • 嗨@PjoterS,谢谢,它帮助了我。我的名称服务器在 google 中,并且我的域是有效的,因为我输入了“Host -t -NS mydomain.com”,它显示了 namesevrers。但是当我使用 kops 启动集群时,它会抛出错误,因为它找不到 DNS 名称。那么这是否意味着我需要使用亚马逊的域名服务器?
猜你喜欢
  • 2021-05-14
  • 2022-08-18
  • 2020-08-01
  • 2020-01-19
  • 2018-07-22
  • 2018-09-17
  • 2020-05-05
  • 2019-06-24
  • 2021-10-12
相关资源
最近更新 更多