【问题标题】:openshift request fails frequentlyopenshift 请求经常失败
【发布时间】:2018-10-21 15:27:00
【问题描述】:

我已经在 openshift (tomcat) 中部署了我的 web 服务,每次我请求我的服务时,有时它会工作,有时它不工作。 它以前工作得很好,pod 的数量是 1 没有失败的日志

错误是

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

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

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

路由和路径匹配,但所有 pod 都已关闭。确保此路由公开的资源(pod、服务、部署配置等)至少有一个 pod 正在运行。

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>

【问题讨论】:

  • 如果这是间歇性工作,这可能是基础架构的问题,而不是您的代码/定义中的问题。我鼓励您尝试从您的机器curling 您的端点,然后从 Pod 终端尝试curling localhost (127.0.0.1)。如果 localhost 总是成功,并且您的机器的 curl 仍然显示间歇性故障,那么这可能是路由器的问题。对于基础设施问题,例如路由器故障,您可以通过 help.openshift.com 联系 OpenShift Online 社区团队

标签: openshift


【解决方案1】:

最初的想法是路由试图将负载分散到多个服务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 doc 的输出并编辑构建 pod(因为它们不相关)。没有立即作为应用程序/配置问题跳出;

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>

【讨论】:

  • 嗨@Shea,您可以在下面的链接drive.google.com/open?id=1dPVHyI0awNpnXNq85nJXm3NIyiHAr3_L 的txt 文件中找到整个配置,因为字符数超出限制,我无法在此处提供全部信息。
  • @suneel,通常情况下,用户只需编辑他们的原始帖子以包含附加信息,例如请求的输出......这样,所有可能的回答者都可以使用它......虽然,这是一个 很多信息...所以也许最好留在谷歌文档中;)
  • @suneel 唯一有点可疑的是Host Port: 0/TCP 我还没有看到在在线产品中利用主机端口的能力,但我也不确定它是否相关以任何方式。
猜你喜欢
  • 2013-11-01
  • 2019-06-09
  • 1970-01-01
  • 2017-11-13
  • 1970-01-01
  • 2012-05-03
  • 1970-01-01
  • 1970-01-01
  • 2012-07-02
相关资源
最近更新 更多