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