2

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!!

Raj
  • 3,637
  • 8
  • 29
  • 52
vishwa
  • 43
  • 4
  • Ive tried to create cluster using kops. Could you share output of `aws route53 list-hosted-zones-by-name` ? If you will try with `--dns-zone=dev.devops.com` you will get the same error? – PjoterS Nov 05 '19 at 15:09
  • `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" } ` – vishwa Nov 06 '19 at 22:02
  • i was getting below error when i used to --dns-zone=dev.devops.com W1106 21:57:49.025751 22867 executor.go:130] error running task "IAMRolePolicy/masters.dev.devops.com" (9m59s remaining to succeed): error rendering PolicyDocument: error opening resource: DNS ZoneID not set W1106 21:57:49.026066 22867 executor.go:130] error running task "IAMRolePolicy/nodes.dev.devops.com" (9m59s remaining to succeed): error rendering PolicyDocument: error opening resource: DNS ZoneID not set – vishwa Nov 06 '19 at 22:05

1 Answers1

1

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 like etcd-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

halfer
  • 19,824
  • 17
  • 99
  • 186
PjoterS
  • 12,841
  • 1
  • 22
  • 54
  • Hi @PjoterS.. Thanks so much for helping..Command you provided is worked and thanks again for explaining about DNS and Route 53 – vishwa Nov 07 '19 at 16:41
  • Hi @PjoterS, Thanks, it helped me. My name servers are in google and my domain is valid, as I put "Host -t -NS mydomain.com" and it shows the namesevrers. But when I use kops to spin up the cluster, it throws error as it can't find DNS names. So does that mean I need to use amazon's nameservers ? – ARINDAM BANERJEE Dec 28 '19 at 19:41