[英]Kubernetes service with external name curl
Well, I created kubernetes-service.yaml file, now i suppose, that on the port 8081 my backend service will be exposed under the domain of my.backend.com. 好吧,我创建了kubernetes-service.yaml文件,现在我想,在端口8081上,我的后端服务将暴露在my.backend.com的域下。 I would like to check whether its accessible, however I have it available only within a cluster. 我想检查它是否可访问,但是我只能在集群中使用它。 How do I do that? 我怎么做? I dont want to expose service externally, I just want to make curl my.backend.com inside a cluster to check results. 我不想在外部公开服务,我只想在群集内卷曲my.backend.com以检查结果。 Is there any workaround of that? 有什么解决方法吗?
apiVersion: v1
kind: Service
metadata:
name: backend-service
labels:
app: backend
spec:
type: ExternalName
selector:
app: backend
ports:
- protocol: TCP
port: 8081
targetPort: 8080
externalName: my.backend.com
The service itself is only exposed within the cluster, however, the FQDN my.backend.com is not handled or controlled by the cluster. 服务本身仅在群集中公开,但是FQDN my.backend.com不受群集处理或控制。 This is likely a publicly accessible URL so you can curl from anywhere. 这可能是可公开访问的URL,因此您可以在任何地方卷曲。 You'll have to configure your domain in a way that restricts who can access it. 您必须以一种限制谁可以访问它的方式来配置域。
The service type externalName is external to the cluster and really only allows for a CNAME redirect from within your cluster to an external path. 服务类型externalName在群集外部,实际上仅允许CNAME从群集内部重定向到外部路径。 I'm sure what you are trying to do, but it's not a change you make at the cluster level. 我确定您要尝试执行的操作,但这不是您在集群级别进行的更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.