【发布时间】:2021-04-07 17:12:36
【问题描述】:
我想从集群内部调用一个外部 api,所以我遵循了 Kubernetes 文档
如下:
apiVersion: v1
kind: Service
metadata:
name: my-service
namespace: prod
spec:
type: ExternalName
externalName: https://api.github.com/
我能够得到一个带有 externalName 的响应:
externalName: httpbin.org
但是当我使用 http 或 https 端点时它会失败。
我知道文档说明了以下内容
Warning:
You may have trouble using ExternalName for some common protocols, including HTTP and HTTPS. If you use ExternalName then the hostname used by clients inside your cluster is different from the name that the ExternalName references.
For protocols that use hostnames this difference may lead to errors or unexpected responses. HTTP requests will have a Host: header that the origin server does not recognize; TLS servers will not be able to provide a certificate matching the hostname that the client connected to.
但我想知道如何从集群内部对外部 API 进行 http/https 调用?
【问题讨论】:
标签: kubernetes kubernetes-ingress kong