openshift请求经常失败

时间:2018-10-21 15:27:01

标签: openshift

我已经在openshift(tomcat)中部署了我的Web服务,每次我请求我的服务时,有时它都起作用,有时却不起作用。 之前运行良好,pod的数量为1,没有失败日志

错误是

  

应用程序不可用   该应用程序当前不在此端点上处理请求。它可能尚未启动或仍在启动。

     

您看到此页面的可能原因:   主机不存在。确保正确键入了主机名,并且存在与该主机名匹配的路由。

     

主机存在,但没有匹配的路径。检查URL路径的键入是否正确,以及是否使用所需的路径创建了路由。

     

路线和路径匹配,但所有吊舱均关闭。确保此路由公开的资源(容器,服务,部署配置等)至少有一个容器正在运行。

O/P of oc describe routes
Name:           mysample
Namespace:      enzen
Created:        12 days ago
Labels:         app=mysample
Annotations:        openshift.io/host.generated=true
Requested Host: mysample-enzen.193b.starter-ca-central-1.openshiftapps.com
exposed on router router (host elb.193b.starter-ca-central-1.openshiftapps.com) 12 days ago
Path:           <none>
TLS Termination:    <none>
Insecure Policy:    <none>
Endpoint Port:      8080-tcp
Service:    mysample
Weight:     100 (100%)
Endpoints:  10.128.18.210:8080

O/P of oc describe services
Name:              mysample
Namespace:         enzen
Labels:            app=mysample
Annotations:       openshift.io/generated-by=OpenShiftNewApp
Selector:          app=mysample,deploymentconfig=mysample
Type:              ClusterIP
IP:                172.30.145.245
Port:              8080-tcp  8080/TCP
TargetPort:        8080/TCP
Endpoints:         10.128.18.210:8080
Session Affinity:  None
Events:            <none>

1 个答案:

答案 0 :(得分:0)

最初的想法是,路由正在尝试将负载分散到多个服务https://docs.openshift.com/container-platform/3.9/architecture/networking/routes.html#alternateBackends中,并且其中一个服务已关闭或不可用。通常,在这种情况下,我将重新创建服务和路由以验证是否已按预期配置它。也许您可以共享路由,服务和Pod的配置?

oc describe routes
oc describe services
oc describe pods

####编辑10-22-18 ####

添加带有已删除的构建容器(因为它们不相关)的Google文档输出,以使更多读者受益。应用/配置问题尚未解决。

oc describe routes
Name:           mysample
Namespace:      enzen
Created:        12 days ago
Labels:         app=mysample
Annotations:        openshift.io/host.generated=true
Requested Host:     mysample-enzen.193b.starter-ca-central-1.openshiftapps.com
              exposed on router router (host elb.193b.starter-ca-central-1.openshiftapps.com) 12 days ago
Path:           <none>
TLS Termination:    <none>
Insecure Policy:    <none>
Endpoint Port:      8080-tcp

Service:    mysample
Weight:     100 (100%)
Endpoints:  10.128.18.210:8080


 oc describe services
Name:              mysample
Namespace:         enzen
Labels:            app=mysample
Annotations:       openshift.io/generated-by=OpenShiftNewApp
Selector:          app=mysample,deploymentconfig=mysample
Type:              ClusterIP
IP:                172.30.145.245
Port:              8080-tcp  8080/TCP
TargetPort:        8080/TCP
Endpoints:         10.128.18.210:8080
Session Affinity:  None
Events:            <none>




oc describe pods
Name:               mysample-15-z85zt
Namespace:          enzen
Priority:           0
PriorityClassName:  <none>
Node:               ip-172-31-29-189.ca-central-1.compute.internal/172.31.29.189
Start Time:         Sun, 21 Oct 2018 20:55:36 +0530
Labels:             app=mysample
                    deployment=mysample-15
                    deploymentconfig=mysample
Annotations:        kubernetes.io/limit-ranger=LimitRanger plugin set: cpu, memory request for container mysample; cpu, memory limit for container mysample
                    openshift.io/deployment-config.latest-version=15
                    openshift.io/deployment-config.name=mysample
                    openshift.io/deployment.name=mysample-15
                    openshift.io/generated-by=OpenShiftNewApp
                    openshift.io/scc=restricted
Status:             Running
IP:                 10.128.18.210
Controlled By:      ReplicationController/mysample-15
Containers:
  mysample:
    Container ID:   cri-o://0cd20854571232b310ce22a282c8d5832908533d28d5d720537bbf3618b86c44
    Image:          docker-registry.default.svc:5000/enzen/mysample@sha256:adadeb7decf82b29699861171c58d7ae5f87ca6eeb1c10e5a1d525e4a0888ebc
    Image ID:       docker-registry.default.svc:5000/enzen/mysample@sha256:adadeb7decf82b29699861171c58d7ae5f87ca6eeb1c10e5a1d525e4a0888ebc
    Port:           8080/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Sun, 21 Oct 2018 20:55:40 +0530
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     1
      memory:  512Mi
    Requests:
      cpu:        20m
      memory:     256Mi
    Environment:  <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-8xjb8 (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  default-token-8xjb8:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-8xjb8
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  type=compute
Tolerations:     node.kubernetes.io/memory-pressure:NoSchedule
Events:          <none>