kubernetes - Micronaut 2.0.0 - 无法在 kubernetes 上调用另一个服务
问题描述
我有一个名为 Identity 的服务,我想从中调用另一个名为 Notification 的服务。这两种服务都是用 构建的Java 11
,Micronaut 2.0.0
并且将部署在kubernetes
.
通知服务的 kubernetes 清单如下所示 -
apiVersion: apps/v1
kind: Deployment
metadata:
name: notification-service
labels:
app: notification-service
spec:
selector:
matchLabels:
app: notification-service
template:
metadata:
labels:
app: notification-service
spec:
containers:
- name: notification-service
image: notification-service
ports:
- containerPort: 8080
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 5
timeoutSeconds: 3
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 5
timeoutSeconds: 3
failureThreshold: 10
---
apiVersion: v1
kind: Service
metadata:
name: notification-service
spec:
type: NodePort
selector:
app: notification-service
ports:
- port: 8080
protocol: TCP
为了调用此服务,我在身份服务中添加了一个声明性客户端,如下所示 -
@Client(id="notification-service")
public interface NotificationClient {
@Get("/health")
String checkHealth();
}
每当我在将checkHealth()
方法注入任何服务或控制器后调用该方法时,请求就会卡住。如果我使用 Micronaut 版本 1.3.x 从任何服务进行调用,调用工作正常。
有人能帮忙吗?
解决方案
推荐阅读
- javascript - 如何在反应中搜索innerHTML
- java - JAVA - 无法更新“资源”文件夹中的文件中的数据
- python - Python 正则表达式无法找到模式 - 在 Apache Spark 上使用 pyspark
- python - 烧瓶会话未检测到会话中的项目中存在
- ruby - Minitest:NoMethodError:nil:NilClass的未定义方法`split'
- r - 模块中的错误(childScope$input,childScope$output,childScope,...):未使用的参数(childScope$output,childScope)
- python - 课程没有运行 - 没有结果
- angular - 我无法从 Angular 的规范文件中访问组件 - Karma/Jasmine 单元测试
- regex - 在 Adobe Bridge 中批量重命名文件
- vuex - 在商店的空数组中传递谷歌地图路线数据