Stuck at "Waiting for API to be available"

I am trying to import an existing Kubernetes cluster (which was set up by using this installation instructions).

Basic overview:

  • CentOS 8
  • Kubernetes 1.22
  • CRI-O 1.22
  • Rancher 2.5.11

Unfortunately, Rancher is stuck with the message “Waiting for API to be available”. By taking a closer look at the API configuration (which, I presume, was created from information reported back by the cattle cluster agent), I kind of understand why. The API endpoint is set to “”. This is the internal IP of the “kubernetes” service, so of course the Rancher server can’t connect to that.

$ kubectl get service --all-namespaces
NAMESPACE          NAME                              TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
calico-apiserver   calico-api                        ClusterIP    <none>        443/TCP                  112m
calico-system      calico-kube-controllers-metrics   ClusterIP      <none>        9094/TCP                 114m
calico-system      calico-typha                      ClusterIP   <none>        5473/TCP                 115m
default            kubernetes                        ClusterIP        <none>        443/TCP                  59d
kube-system        kube-dns                          ClusterIP       <none>        53/UDP,53/TCP,9153/TCP   59d

What I don’t understand is, why that IP was reported back to Rancher as API endpoint. Shouldn’t this be the same address, which is reported by the kubectl config view command and which is the actual physical IP adress of my kubernetes CTL node?

$ kubectl config view
apiVersion: v1
- cluster:
    certificate-authority-data: DATA+OMITTED
  name: kubernetes
$ kubectl cluster-info
Kubernetes control plane is running at
CoreDNS is running at
$ ifconfig
ens192: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet  netmask  broadcast

What am I missing? How can successfully “connect” my Kubernetes cluster with Rancher?

We saw this with k8s 1.21. Dropped back to k8s 1.20 and that resolved “Waiting for API to be available”

Found this in the Rancher release notes:
Importing a Kubernetes v1.21 cluster might not work properly. We are planning to add support for Kubernetes v1.21 in the future.

After reading this post , I got rid of K8s V1.21 after it was stuck at “Waiting for API to be available” . Based on the suggestion, retried the setup after thoroughly cleaning all docker residue from the nodes [Rancher V2.6.3 with K8 1.20.13] now again it seems to be stuck at “Waiting for API to be available” . Please help .

Actually I realized some searching that “Waiting for API to be available” usually points some misconfiguration somewhere. So I decided to tear down all the nodes and then did the following :

  1. Prepared the nodes based on their roles [which I think is what I underestimated in the previous occasion]
  2. Ran the RKE binary 1.2.13 with its corresponding K8s 1.20 version which it supports.
  3. Boom ! - It worked like a charm and then imported that into the UI…

I will post a detailed documentation what I exactly did , but thats for later. Thanks

1 Like

is there any update for this issue, i am getting same error for AKS Cluster.