首页 > 解决方案 > 为什么 AWS 提供商的 OpenShift 安装程序无法连接到 Kubernetes API?

问题描述

OpenShift AWS 安装程序无法等待 Kubernetes API 可用,并出现致命错误“等待 Kubernetes API:超出上下文期限”:

$ openshift-install create cluster --dir=$HOME/openshift --log-level debug
...
DEBUG Still waiting for the Kubernetes API: Get https://api.cluster-name.'IP_ADDRESS'.nip.io:6443/version?timeout=32s: dial tcp 'IP_ADDRESS':6443: i/o timeout 
DEBUG Still waiting for the Kubernetes API: Get https://api.cluster-name.'IP_ADDRESS'.nip.io:6443/version?timeout=32s: dial tcp 'IP_ADDRESS':6443: i/o timeout 
DEBUG Still waiting for the Kubernetes API: Get https://api.cluster-name.'IP_ADDRESS'.nip.io:6443/version?timeout=32s: dial tcp 'IP_ADDRESS':6443: i/o timeout 
DEBUG Still waiting for the Kubernetes API: Get https://api.cluster-name.'IP_ADDRESS'.nip.io:6443/version?timeout=32s: dial tcp 'IP_ADDRESS':6443: i/o timeout 
DEBUG Fetching "Install Config"...                 
DEBUG Loading "Install Config"...                  
DEBUG   Loading "SSH Key"...                       
DEBUG   Using "SSH Key" loaded from state file     
DEBUG   Loading "Base Domain"...                   
DEBUG     Loading "Platform"...                    
DEBUG     Using "Platform" loaded from state file  
DEBUG   Using "Base Domain" loaded from state file 
DEBUG   Loading "Cluster Name"...                  
DEBUG     Loading "Base Domain"...                 
DEBUG   Using "Cluster Name" loaded from state file 
DEBUG   Loading "Pull Secret"...                   
DEBUG   Using "Pull Secret" loaded from state file 
DEBUG   Loading "Platform"...                      
DEBUG Using "Install Config" loaded from state file 
DEBUG Reusing previously-fetched "Install Config"  
INFO Use the following commands to gather logs from the cluster 
... 
FATAL waiting for Kubernetes API: context deadline exceeded 

这里也描述了这个问题

标签: amazon-web-serviceskubernetesopenshift

解决方案


在我的情况下,安装程序尝试连接到链接到不存在的端点的 Kubernetes API。ocif -client 在运行简单命令时挂起的迹象之一oc whoami- 它实际上尝试连接到同一个端点(假设设置了 KUBECONFIG)。
事实证明,它与 Route 53 托管区域有关,尤其是与子域有关。当针对子域(如我的情况)安装 OpenShift 时,需要在主域中创建引用子域的记录集。因此,对于 openshift.example.com,在 aws 控制台中执行以下操作:
转到 Route 53 -> 托管区域 -> 单击 openshift.example.com。(如果它不存在 - 创建一个托管区域) -> 复制 NS 记录,例如:

ns-711.awsdns-24.net.   
ns-126.awsdns-15.com.   
ns-1274.awsdns-31.org.   
ns-1556.awsdns-02.co.uk.

返回托管区域 -> example.com。-> 创建记录集:
为 openshift.example.com 创建记录集,输入:NS - 名称服务器,值:粘贴复制的 NS 记录。

在此更改后,安装成功完成。


推荐阅读