kubernetes - 无法使用Kops命令创建集群

标签 kubernetes devops kops

使用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

有人可以帮帮我吗。提前致谢!!

最佳答案

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

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

In this scenario you want to contain all kubernetes records under a subdomain of a domain you host in Route53. This requires creating a second hosted zone in route53, and then setting up route delegation to the new zone.

In this example you own example.com and your records for Kubernetes would look like etcd-us-east-1c.internal.clustername.subdomain.example.com



您将根据以下doc示例找到该文件: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集群创建部分。
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}

带有信息

The environment variable ${NAME} was previously exported with our cluster 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

关于kubernetes - 无法使用Kops命令创建集群,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58697663/

相关文章:

sql-server - 使用CI/CD管道部署数据库项目时如何设置SQL用户密码

kubernetes - AWS EKS : Do I need to remove kube-dns before install external-dns?

.net - 为什么我不能将 Kubernetes 支持添加到 .NET Core 控制台项目?

ubuntu - minikube 上的 kubernetes 无法输出到文件

kubernetes - 节点在 AWS EKS 中没有可用的卷区域

mysql - 使用SaltStack创建Mysql数据库

java - 无效字符串;意外字符 : 253 hex: fd

amazon-web-services - 水平Pod自动缩放器(HPA):当前利用率:<未知>,带有自定义 namespace

docker - 具有 TLS 且没有用户名的 Kubernetes docker 私有(private)注册表

kubernetes - 删除所有 kubernetes 命名空间中所有 pod 的命令