访问服务的另一个豆荚kubernetes
我的K8有两个服务。
我正在尝试从我的用户服务访问我的钱包服务,但我的卷发CMD刚刚返回504 Gateway超时。
这是我的入学,
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: dev-ingress
namespace: dev
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "false"
# nginx.ingress.kubernetes.io/use-regex: "true"
# nginx.ingress.kubernetes.io/rewrite-target: /api/v1$uri
spec:
ingressClassName: nginx
rules:
- http:
paths:
- path: /api/v1/wallet
pathType: Prefix
backend:
service:
name: wallet-service
port:
number: 80
- path: /api/v1/user
pathType: Prefix
backend:
service:
name: accounts-service
port:
number: 80
这是我在帐户服务中通过ENV的方式。
http:// Wallet-Service:3007
端点时记录URL
在登录我的
,然后 非相关端点有效。
感谢
我正在运行Azure Kubernetes
I have two services running in my k8s.
I am trying to access my wallet service from my user service but my curl cmd just returns 504 gateway timeout.
here is my ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: dev-ingress
namespace: dev
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "false"
# nginx.ingress.kubernetes.io/use-regex: "true"
# nginx.ingress.kubernetes.io/rewrite-target: /api/v1$uri
spec:
ingressClassName: nginx
rules:
- http:
paths:
- path: /api/v1/wallet
pathType: Prefix
backend:
service:
name: wallet-service
port:
number: 80
- path: /api/v1/user
pathType: Prefix
backend:
service:
name: accounts-service
port:
number: 80
this is the way I passed the env in my account service.
http://wallet-service:3007
and I log the URL when hitting my endpoint
curl http://EXTERNAL_IP/api/v1/user/health/wallet
every other non-related endpoint works.
Any help is appreciated
I am running Azure Kubernetes
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您有实际的K8S服务吗?
kubectl获取SVC -A
检查它,您应该在那里看到您的服务检查您的豆荚已接触到服务
您是否在云提供商(GCP,Azure,AWS等)上运行,如果是这样,请检查您的安全配置(NSG for Azure,AWS的安全策略,适用于AWS的安全策略,等)
检查内部通信:
更新:
MS_XXXX
资源,而您的NSG组将位于此资源组下,进行编辑并打开您试图连接到http://的 所需端口钱包服务:3007/api/v1/Wallet/Health-您从哪里获得3007端口?
Do you have an actual K8S service?
kubectl get svc -A
and you should see your services thereCheck to see that your pods are exposed to the services
Are you running on a cloud provider (GCP, Azure, AWS, etc), if so check your security configuration as well (NSG for Azure, a security policy for AWS, etc)
Check inner communication :
Update:
MS_xxxx
resource and your NSG group will be located under this resource group, edit it and open the desired portsYou are trying to connect to http://wallet-service:3007/api/v1/wallet/health - Where did you get the 3007 port?