I am having an issue while creating a k8 cluster with kops command.
This is the error i was getting when i am trying to create cluster.
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.]
commands i used to create cluster:
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
Can someone please help me. Thanks in advance!!
You have registered your dns-zone
as uswest2.dev.devops.com
and you are referring in command to name as dev.devops.com
.
If you will check this docs, especially Configure DNS section, you will find that:
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
You will find that based on this doc example: etcd-us-east-1c.internal.clustername.subdomain.example.com
Your dev.devops.com
is domain and uswest2.dev.devops.com
is your subdomain.
In Route 53 docs you will be able find example where subdomain for example.org
in this case was set as 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"
]
At this moment: subdomain: kopsclustertest
domain: example.org
A few chapters below you will find KOPS CLUSTER CREATION section.
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}
with information that
The environment variable ${NAME} was previously exported with our cluster name:
mycluster01.kopsclustertest.example.org
.
It means that before subdomain.domain
you need to specify your cluster name.
In short, in flag --name
you must specify: <your_cluster_name>.subdomain.domain
Please try:
kops create cluster --cloud=aws --zones=us-west-2b --name=my-cluster.uswest2.dev.devops.com --dns-zone=uswest2.dev.devops.com --dns private