当前位置: 首页 > 知识库问答 >
问题:

openshift请求经常失败

曹旭东
2023-03-14

我已经部署了我的webservice在OpenShift(Tomcat),每次我请求我的服务时,有时它工作,有时它不工作。

错误是

应用程序不可用应用程序当前未在此endpoint上为请求提供服务。它可能尚未启动或仍在启动。

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

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

路线和路径匹配,但所有吊舱都关闭了。确保此路由公开的资源(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>

共有1个答案

徐唯
2023-03-14

最初的想法是路由试图将负载分散到多个服务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>
 类似资料:
  • 异常严重:Servlet。路径为[z2]的上下文中servlet[dispatcher]的service()引发异常[请求处理失败;嵌套异常为org.springframework.dao.DataIntegrityViolationException:not null属性引用null或瞬时值:com.spring.entity.Product.cd;嵌套异常为org.hibernate.Prop

  • 但是在随机设置上面注释后的真实行为像:pod1、pod1、pod2、pod2、pod3、pod1、pod2、pod2....这是不正确的。 我们是否需要配置任何openshift配置,使其完善的RoundRoubin?

  • 当我尝试连接到Oracle数据库时,出现了以下问题。 有例外 此reportMapper.xml

  • HTTP/1.1 408 REQUEST_TIMEOUT内容-长度:0连接:关闭 已关闭 --------------------------------------------------------------------------------------- 它会导致请求超时。如果我使用curl命令,它是成功的。 请求超时的原因是什么?

  • 这是我的第一个问题。我对API上的http请求有问题。当我发出请求时,控制台上会显示以下错误: 异常:找不到不同类型'对象'的支持对象'[对象对象]'。NgFor仅支持绑定到Iterable,如Array。 每个文件的内容如下: 靴子ts 应用程序。组成部分ts peli.service.ts peli.ts 以及我从请求中收到的JSON文件(输入-蜘蛛侠): 我不知道问题出在哪里,一切似乎都很好

  • 类项目: hbm文件: 方法如下: