[英]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"]
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.