我的Minikube (安装在Mac上)中运行着一个服务(/deployment/pod),它需要调用一个直接在Mac上运行的外部http服务(即Minikube外部)。该外部服务的域名被定义到我的Mac /etc/hosts文件中。然而,我在Minikube中的服务不能调用该外部服务。知道我需要在哪里配置什么吗?非常感谢。C
发布于 2019-02-01 01:04:51
创建将流量转发到所需外部IP地址(本地计算机)的Endpoints。您可以使用Endpoints直接连接,但根据Goole Cloud best practice (doc),它是通过Service访问的

创建您的Endpoints
kind: Endpoints
apiVersion: v1
metadata:
name: local-ip
subsets:
- addresses:
- ip: 10.240.0.4 # IP of your desire end point
ports:
- port: 27017 # Port that you want to access然后创建你的Service
kind: Service
apiVersion: v1
metadata:
name: local-ip
Spec:
type: ClusterIP
ports:
- port: 27017
targetPort: 27017现在您可以使用Service名称调用外部http服务。在本例中,loal-ip就像minikube的任何其他内部服务一样。
发布于 2019-02-01 00:31:49
因为您的minikube是在笔记本电脑上的虚拟机上运行的,所以您只需在该虚拟机的/etc/hosts文件中输入外部服务的地址,然后使用minikube ssh进入该计算机。
https://stackoverflow.com/questions/54464722
复制相似问题