简体   繁体   English

Java/Micronaut 的 Kube.netes 部署错误:ERR_CONNECTION_REFUSED

[英]Kubernetes deployment error with Java/Micronaut: ERR_CONNECTION_REFUSED

I am trying to deploy an app having 3 services - frontend (Angular), backend 1 (Java/Micronaut), and backend 2 (Java/Micronaut).我正在尝试部署具有 3 个服务的应用程序 - 前端 (Angular)、后端 1 (Java/Micronaut) 和后端 2 (Java/Micronaut)。

My frontend works properly but the Java apps are not working.我的前端工作正常,但 Java 应用程序不工作。

Sometimes, I observed it started after 20 min.有时,我观察到它在 20 分钟后开始。 of deploying a Java app, but this time it does not work even after 1 hr.部署 Java 应用程序,但这次即使在 1 小时后它也不起作用。

Deployment, pod service - all are in running state in Kube.netes, but when I try to hit the URL I see below error:部署、pod 服务——所有这些都在 Kube.netes 中运行 state,但是当我尝试点击 URL 时,我看到以下错误:

在此处输入图像描述

deployment.yaml for java app deployment.yaml 用于 java 应用程序

apiVersion: apps/v1
kind: Deployment
metadata:
  name: authentication-deploy
  labels:
    name: authentication-deploy
    app: supply-chain-app
spec:
  replicas: 1
  selector:
    matchLabels:
      name: authentication-pod
      app: supply-chain-app

  template:
    metadata:
      name: authentication-pod
      labels:
        name: authentication-pod
        app: supply-chain-app
    spec:
      containers:
        - name: authentication
          image: cawishika/authentication-service:1.1
          ports:
            - containerPort: 80

service.yaml for java app service.yaml 为 java 应用程序

apiVersion: v1
kind: Service
metadata:
  name: authentication-service
  labels:
    name: authentication-service
    app: supply-chain-app
spec:
  type: NodePort
  ports:
    - port: 80
      targetPort: 80
      nodePort: 30006
  selector:
    name: authentication-pod
    app: supply-chain-app

Docker file Docker 档案

FROM adoptopenjdk/openjdk11:latest
EXPOSE 8002
ADD target/authentication-service-0.1.jar authentication-service-0.1.jar
ENTRYPOINT ["java", "-jar", "/authentication-service-0.1.jar"]

kubectl logs podname kubectl 记录 pod 名称在此处输入图像描述

服务器运行

Your Dockerfile is exposing port 8002 ( EXPOSE 8002 ), but your app is started on port 8080 .您的 Dockerfile 正在公开端口8002 ( EXPOSE 8002 ),但您的应用程序是在端口8080上启动的。

Additionally, your Kube.netes configuration is pointing to port 80 of your pod.此外,您的 Kube.netes 配置指向 pod 的端口80

You should set it so that all three configurations use the same port.您应该设置它,以便所有三个配置使用相同的端口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 春季ERR_CONNECTION_REFUSED - Spring ERR_CONNECTION_REFUSED 从OncePerRequestFilter(Java + Spring)抛出与net :: ERR_CONNECTION_REFUSED不同的错误 - Throw different error than net::ERR_CONNECTION_REFUSED from OncePerRequestFilter ( Java + Spring ) Stackify 前缀 sfclient ERR_CONNECTION_REFUSED - Stackify Prefix sfclient ERR_CONNECTION_REFUSED Tomcat管理器ERR_CONNECTION_REFUSED - Tomcat manager ERR_CONNECTION_REFUSED 码头工人微服务err_connection_refused - docker microservice err_connection_refused org.openqa.selenium.WebDriverException:未知错误:.net::ERR_CONNECTION_REFUSED - org.openqa.selenium.WebDriverException: unknown error: net::ERR_CONNECTION_REFUSED tomcat10主页无法通过键入localhost加载:8080错误:ERR_CONNECTION_REFUSED - tomcat10 home page can not load by typing localhost:8080 error: ERR_CONNECTION_REFUSED Selenium/TestBench 失败:net::ERR_CONNECTION_REFUSED - Selenium/TestBench failure: net::ERR_CONNECTION_REFUSED Spring 引导应用程序:net::ERR_CONNECTION_REFUSED - Spring Boot application: net::ERR_CONNECTION_REFUSED 如果我在春季使登录页面使用'https',如何避免错误102(net :: ERR_CONNECTION_REFUSED)? - If I make my login page use 'https' in Spring, how do I avoid Error 102 (net::ERR_CONNECTION_REFUSED)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM