与服务器master.ctwifi.cn:8443的连接被拒绝-您是否指定了正确的主机或端口?\ n“

时间:2018-10-01 15:19:01

标签: openshift openshift-origin okd

描述
  •   

    CentOS 7.4

  •   

    我使用了Ansible安装OpenShift,并且必须使用HTTP_PROXY。

  •   

    我有这样一个问题:“ stderr”:“与服务器master.ctwifi.cn:8443的连接被拒绝-您指定了正确的主机还是   端口?\ n“,

  •   

    并且主主机上没有8443端口。在主主机上运行的容器数仅为5。我认为kubernetes master尚未启动,但我不知道为什么。

         

    但是我使用相同的配置来安装在公共云上除了代理配置,没有问题。所以我认为这个问题与我的代理配置有关。但是我没有找到解决方法。

    ansible-playbook〜/ openshift-ansible / playbooks / prerequisites.yml -vvv 可以

image

问题

ansible-playbook〜/ openshift-ansible / playbooks / deploy_cluster.yml -vvv

FAILED - RETRYING: Wait for control plane pods to appear (57 retries left).Result was: {
    "attempts": 4,
    "changed": false,
    "invocation": {
        "module_args": {
            "all_namespaces": null,
            "content": null,
            "debug": false,
            "delete_after": false,
            "field_selector": null,
            "files": null,
            "force": false,
            "kind": "pod",
            "kubeconfig": "/etc/origin/master/admin.kubeconfig",
            "name": "master-etcd-master.ctwifi.cn",
            "namespace": "kube-system",
            "selector": null,
            "state": "list"
        }
    },
    "msg": {
        "cmd": "/usr/bin/oc get pod master-etcd-master.ctwifi.cn -o json -n kube-system",
        "results": [
            {}
        ],
        "returncode": 1,
        **"stderr": "The connection to the server master.ctwifi.cn:8443 was refused - did you specify the right host or port?\n",**
        "stdout": ""
    },
    "retries": 61
```
ansible 2.6.4
#git describe
openshift-ansible-3.10.51-1-16-g1a911c5
#rpm -q openshift-ansible
openshift-ansible-3.10.51-1.git.0.44a646c.el7.noarch

我的主机文件(每个主机之间的通讯都没有问题):

10.199.27.49 master.ctwifi.cn
10.199.27.48 node01.ctwifi.cn
10.199.27.46 node02.ctwifi.cn
10.199.27.28 infra-node1.ctwifi.cn

我的/ etc / sysconfig / docker文件:

HTTP_PROXY='http://'username:password'@proxy.ctwifi.cn:8080'
HTTPS_PROXY='http://'username:password'@proxy.ctwifi.cn:8080'  NO_PROXY=10.199.27.49,10.199.27.46,10.199.27.48,10.199.27.28,master.ctwifi.com,node01.ctwifi.cn,node02.ctwifi.cn,infra-node1.ctwifi.cn,.cluster.local,.svc,localhost,127.0.0.1,172.30.0.1
export HTTP_PROXY HTTPS_PROXY  NO_PROXY
OPTIONS=' --selinux-enabled    --signature-verification=False'
if [ -z "${DOCKER_CERT_PATH}" ]; then
     DOCKER_CERT_PATH=/etc/docker
fi
  • 我的操作系统和版本:CentOS 7.4

我的库存文件

#Create an OSEv3 group that contains the masters and nodes groups
[OSEv3:children]
masters
nodes
etcd
#Set variables common for all OSEv3 hosts
[OSEv3:vars]
#SSH user, this user should allow ssh based auth without requiring a password
ansible_ssh_user=root

#If ansible_ssh_user is not root, ansible_become must be set to true
#ansible_become=true

openshift_deployment_type=origin

#uncomment the following to enable htpasswd authentication; defaults to AllowAllPasswordIdentityProvider
#openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider'}] 
#openshift_release=3.10


openshift_disable_check=memory_availability,docker_image_availability,package_availability,package_version

#host group for masters
[masters]
master.ctwifi.cn

#host group for etcd
[etcd]
master.ctwifi.cn

#host group for nodes, includes region info
[nodes]
master.ctwifi.cn openshift_node_group_name='node-config-master'
#node01.ctwifi.cn openshift_node_group_name='node-config-compute'
node02.ctwifi.cn openshift_node_group_name='node-config-compute'
infra-node1.ctwifi.cn openshift_node_group_name='node-config-infra'

1 个答案:

答案 0 :(得分:0)

FAILED - RETRYING: Wait for control plane pods...表示API服务器存在问题。它本身的问题是多种多样的。我没有足够的意见要发表,但我会尽力回答。

有时openshift找不到通往吊舱的路线,如果存在这种情况,那么 在openshift_set_node_ip=true中添加[OSEv3:vars]并将osnode1 openshift_ip=xxx.xxx.xxx.xxx ....放入每个节点。

有时候,如果没有创建用户,就会出现问题,那么您必须添加 openshift_master_htpasswd_users={'admin': '$apr1$RbOvaj8r$LEqJqG6V/O/i7Pf...'}

另外,API和ETCD最好放在不同的位置。

下面是您的清单文件,我做了一些编辑,请看一下:

#Create an OSEv3 group that contains the masters and nodes groups
[OSEv3:children]
masters
nodes
etcd
#Set variables common for all OSEv3 hosts
[OSEv3:vars]
#SSH user, this user should allow ssh based auth without requiring a password
ansible_ssh_user=root

#If ansible_ssh_user is not root, ansible_become must be set to true
#ansible_become=true

openshift_deployment_type=origin
openshift_set_node_ip=true

#uncomment the following to enable htpasswd authentication; defaults to AllowAllPasswordIdentityProvider
#openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider'}]
openshift_master_htpasswd_users={'admin': '$apr1$RbOvaj8r$LEqJqG6V/O/i7Pf...'}
#openshift_release=3.10

openshift_check_min_host_memory_gb=8
openshift_check_min_host_disk_gb=10
openshift_disable_check=docker_image_availability

#host group for masters
[masters]
master.ctwifi.cn

#host group for etcd
[etcd]
node02.ctwifi.cn

#host group for nodes, includes region info
[nodes]
master.ctwifi.cn openshift_ip=10.10.0.231 openshift_schedulable=true openshift_node_group_name='node-config-master'
#node01.ctwifi.cn openshift_ip=10.10.0.232 openshift_schedulable=true openshift_node_group_name='node-config-compute'
node02.ctwifi.cn openshift_ip=10.10.0.233 openshift_schedulable=true openshift_node_group_name='node-config-compute'
infra-node1.ctwifi.cn openshift_ip=10.10.0.234 openshift_schedulable=true openshift_node_group_name='node-config-infra'

我正在使用centos7.5和openshift-ansible的发行版 https://github.com/openshift/openshift-ansible/archive/openshift-ansible-3.10.52-1.tar.gz。它运行良好,在我的VM上没有问题。 这是我的最低库存文件,以备您比较:

[OSEv3:children]
masters
nodes
etcd

[masters]
osnode1

[etcd]
osnode3

[nodes]
osnode1 openshift_ip=10.10.0.231 openshift_schedulable=true openshift_node_group_name='node-config-master'
osnode2 openshift_ip=10.10.0.232 openshift_schedulable=true openshift_node_group_name='node-config-infra'
osnode3 openshift_ip=10.10.0.233 openshift_schedulable=true openshift_node_group_name='node-config-compute'

[OSEv3:vars]
ansible_ssh_user=root
openshift_deployment_type=origin
openshift_release="3.10"
openshift_image_tag="v3.10"
openshift_set_node_ip=true
openshift_master_default_subdomain=apps.k8s.labs
openshift_docker_selinux_enabled=True
openshift_check_min_host_memory_gb=16
openshift_check_min_host_disk_gb=50
openshift_disable_check=docker_image_availability
os_sdn_network_plugin_name='redhat/openshift-ovs-multitenant'
openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true','challenge':'true', 'kind': 'HTPasswdPasswordIdentityProvider'}]
openshift_master_htpasswd_users={'admin': '$apr1$RbOvaj8r$LEqJqG6V/O/i7Pfyyyyyy.', 'user': '$apr1$MfsFK97I$enQjqHCh2LL8w4EBwNrrrr'}