在OpenShift Origin中公开服务无法正常工作

时间:2017-03-21 19:43:24

标签: tomcat ansible openshift kubernetes openshift-origin

我是使用OpenShift Origin的新手。我使用ansible-openshift安装了1个主节点和2个节点。 一切似乎都没问题。我可以访问http://10.1.10.1:8443处的信息中心。但是,当我想公开服务时,问题出现了,所以我做了:

  1. 我通过Dashboard部署了一个tomcat容器。
  2. 然后,我创建了一个路由,以便通过主机,也通过仪表板暴露tomcat但是当我转到http://10.1.10.1:8080(主IP:暴露端口)不起作用时,出现连接拒绝。
  3. 操作系统版本

    CentOS Linux release 7.3.1611 (Core)
    

    OC版

    oc v1.4.1+3f9807a
    kubernetes v1.4.0+776c994
    features: Basic-Auth GSSAPI Kerberos SPNEGO
    Server https://10.1.10.1:8443
    openshift v1.4.1+3f9807a
    kubernetes v1.4.0+776c994
    

    ansible / hosts

    # 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] 
    ansible_user=root
    ansible_become=true
    deployment_type=origin 
    openshift_release=1.4.1
    containerized=true 
    openshift_router_selector='router=true'
    openshift_registry_selector='registry=true'
    enable_docker_excluder=false 
    enable_excluders=false
    os_firewall_use_firewalld=false 
    
    # enable htpasswd auth 
    openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'}]
    openshift_master_htpasswd_users={'admin': '$apr1$zgSjCrLt$1KSuj66CggeWSv.D.BXOA1', 'user': '$apr1$.gw8w9i1$ln9bfTRiD6OwuNTG5LvW50'}
    
    # host group for masters 
    [masters]
    10.1.10.1 openshift_public_hostname=10.1.10.1 openshift_hostname=os-master
    
    # host group for etcd, should run on a node that is not schedulable
    #[etcd]
    #54.175.0.44 
    
    # host group for worker nodes, we list master node here so that
    # openshift-sdn gets installed. We mark the master node as not 
    # schedulable. 
    [nodes]
    10.1.10.1openshift_hostname=10.1.10.1 openshift_schedulable=false
    10.1.10.2openshift_hostname=10.1.10.2openshift_node_labels="{'router':'true','registry':'true'}"
    10.1.10.3 openshift_hostname=10.1.10.3 openshift_node_labels="{'router':'true','registry':'true'}"
    

    oc adm diagnostics命令仅显示2个警告:

    WARN:  [DH0005 from diagnostic MasterConfigCheck@openshift/origin/pkg/diagnostics/host/check_master_config.go:52]
           Validation of master config file '/etc/origin/master/master-config.yaml' warned:
           assetConfig.loggingPublicURL: Invalid value: "": required to view aggregated container logs in the console
           assetConfig.metricsPublicURL: Invalid value: "": required to view cluster metrics in the console
           auditConfig.auditFilePath: Required value: audit can now be logged to a separate file
    WARN:  [DClu0003 from diagnostic NodeDefinition@openshift/origin/pkg/diagnostics/cluster/node_definitions.go:112]
           Node 10.1.10.1 is ready but is marked Unschedulable.
           This is usually set manually for administrative reasons.
           An administrator can mark the node schedulable with:
               oadm manage-node 10.1.10.1 --schedulable=true
    
           While in this state, pods should not be scheduled to deploy on the node.
           Existing pods will continue to run until completed or evacuated (see
           other options for 'oadm manage-node').
    

    你能否对此有所了解? 提前谢谢。

1 个答案:

答案 0 :(得分:-1)

我遇到过类似的issue。我确实配置了ansible-container。我可以知道你已经部署了哪种用户tomcat app?你是否使用过用户的开发者/开发者'或者您是否创建了另一个用户? 可能的原因可能是您的用户权利不足(根据我的经验,这是正确的)。我建议你做两件事,

1)执行this

,检查路由器/服务是否配置正确

2)如果您的用户没有足够的角色,那么do thisthis可以使拉动图像正常工作。 (例如:$$$ oc adm policy add-scc-to-user anyuid -z default