Pod通讯 [英] Pod Communication

查看:64
本文介绍了Pod通讯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Kubernetes中如何在两个不同的Pod之间进行通信?

How does the communication between two different pods happen in Kubernetes?

在我的情况下,我有两个Pod: frontend backend ,它们都有不同的容器. 我希望前端Pod与后端Pod通信,但是我不想使用后端Pod的IP(即硬编码).

In my case I have two pods: frontend and backend, both have different containers. I want my frontend pod to communicate with the backend pod but I don't want to use backend pod's IP( i.e. hard coded).

通过服务有可能吗?

推荐答案

可以通过服务吗?

Is it possible through services?

是的,推荐使用服务.为每个Pod(或建议的复制控制器)设置服务后,即可通过

Yes, services are the recommended way to handle this. Once you have your services set up for each pod (or replication controller, as is recommended), you can find the service IP via the service environment variable, e.g. BACKEND_SERVICE_HOST and BACKEND_SERVICE_PORT for a "backend" service.

这篇关于Pod通讯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆