1
描述
  • CentOS 7.4

  • 我使用 Ansible 安装 OpenShift,我必须使用 HTTP_PROXY。

  • 我有这样一个问题: "stderr": "与服务器 master.ctwifi.cn:8443 的连接被拒绝 - 你指定了正确的主机或端口吗?\n",

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

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

    ansible-playbook ~/openshift-ansible/playbooks/prerequisites.yml -vvv 没问题

图片

问题

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

我的hosts文件(各主机间通讯没问题):

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'
4

1 回答 1

0

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

有时openshift找不到到pod的路由,如果有这种情况,然后添加并放入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。它运行良好,在我的虚拟机上没有问题。这是我的最低库存文件,如果您想比较它:

[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'}
于 2018-10-03T12:19:01.353 回答