0

I'm initializing the cluster using kube-adm tool and its failing.The reason is when kube-api server comes up , it looks for configuration and in configuration we have set "--advertise-address" flag as DNS entry instead of actual IP.

Cluster gets initilized when we change this to IP address but use case is that we need to have DNS entry there. Any way out?

ubuntu@ac1poc-20210407164708-dbvault-master1:~$ sudo docker ps -a
CONTAINER ID        IMAGE                    COMMAND                  CREATED             STATUS                     PORTS               NAMES
6dadb094ef45        4d217480042e             "kube-apiserver --ad…"   8 seconds ago       Exited (1) 7 seconds ago                       k8s_kube-apiserver_kube-apiserver-ac1poc-20210407164708-dbvault-master1_kube-system_d178ca26dd6ecb571ee1d795bf05d13c_0
9800cd1306ca        k8s.gcr.io/pause:3.4.1   "/pause"                 8 seconds ago       Up 7 seconds                                   k8s_POD_kube-apiserver-ac1poc-20210407164708-dbvault-master1_kube-system_d178ca26dd6ecb571ee1d795bf05d13c_0
447ca3b7c4e5        0369cf4303ff             "etcd --advertise-cl…"   18 seconds ago      Up 17 seconds                                  k8s_etcd_etcd-ac1poc-20210407164708-dbvault-master1_kube-system_aeecb86186a97a57d7b33389c398d994_0
f10dee583a73        k8s.gcr.io/pause:3.4.1   "/pause"                 18 seconds ago      Up 17 seconds                                  k8s_POD_etcd-ac1poc-20210407164708-dbvault-master1_kube-system_aeecb86186a97a57d7b33389c398d994_0
ff24fb98ffc4        62ad3129eca8             "kube-scheduler --au…"   28 seconds ago      Up 27 seconds                                  k8s_kube-scheduler_kube-scheduler-ac1poc-20210407164708-dbvault-master1_kube-system_043da16f3c9ebc5b6dc6a04761c2f844_0
3fb783c0d8c7        k8s.gcr.io/pause:3.4.1   "/pause"                 28 seconds ago      Up 27 seconds                                  k8s_POD_kube-scheduler-ac1poc-20210407164708-dbvault-master1_kube-system_043da16f3c9ebc5b6dc6a04761c2f844_0
ubuntu@ac1poc-20210407164708-dbvault-master1:~$ sudo docker logs 6dadb094ef45
Error: invalid argument "ac1poc-20210407164708-kube-api-f5082ea18c7584ad.elb.us-east-1.amazonaws.com" for "--advertise-address" flag: failed to parse IP: "ac1poc-20210407164708-kube-api-f5082ea18c7584ad.elb.us-east-1.amazonaws.com"

1 Answers1

0

It is not possible to use DNS address in --apiserver-advertise-address.
Official documentation states:

The IP address the API Server will advertise it's listening on. If not set the default network interface will be used.

At one point it seemed like such functionality would be added[apiserver #33][kubernetes #59288], but it was ultimately scrapped, and PR #56956 was merged to ensure only IPv4 and IPv6 can be used.


The workaround would be to use ControlPlaneEndpoint, but API server will not start if IP changes, so it's suboptimal solution.

  • Thanks for detailed explanation – Jatinder Singh Jun 29 '21 at 05:22
  • Hi @JatinderSingh, I'm glad I could help. Please consider [accepting](https://serverfault.com/help/someone-answers) an answer, and maybe upvoting it, so this question won't stay as unanswered. –  Jun 29 '21 at 05:58