如何通过Localhost的DNS名称访问Kubernetes服务,哪个是Docker Desktop/Kubernetes?
我有这样的配置localhost
在上面安装了带有Kubernetes的Docker桌面。
例如,我部署了一些Cassandra服务器作为状态表,我创建了这样的服务,以使各个Pods从状态满集中揭露。我无法使用Cassandra
服务,因为对于某些Cassandra操作,默认负载平衡是有毒的。我需要在无头服务或选定的种子吊舱中连接所有豆荚 - 在这种情况下,无近的选择是最佳选择。
apiVersion: v1
kind: Service
metadata:
name: cassandra-0
spec:
type: LoadBalancer
selector:
statefulset.kubernetes.io/pod-name: cassandra-0
ports:
- name: cql
protocol: TCP
port: 9042
targetPort: 9042
我想将其暴露为Localhost内部的Cassandra-0。。。
我该怎么做才能以最简单的方式做到这一点?
我现在想象的,但也许不需要。
- 将一些Localhost DNS配置为Cassandra-0:9042点9042。
- 使用NGINX将流量路由到特定的裸露端口(9042,9043,...),用于(Cassandra-0,Cassandra-1,...)
我计划去使用Kubernetes中的POD从Local主持进行测试。
I have such configuration localhost
on which is installed Docker Desktop with Kubernetes.
I deployed for example some cassandra server as statefulset I created such service to expose individual pods from statefulset. I can not use cassandra
service since for some Cassandra operation default load balancing is toxic. I need to connect all pods in headless service or selected seed pods - proxyless option is the best choice in this case by design.
apiVersion: v1
kind: Service
metadata:
name: cassandra-0
spec:
type: LoadBalancer
selector:
statefulset.kubernetes.io/pod-name: cassandra-0
ports:
- name: cql
protocol: TCP
port: 9042
targetPort: 9042
I want to expose it as cassandra-0.. inside localhost.
What should I do to make it in the easiest way?
What I imagine now but maybe it not need.
- Configure some localhost dns to point cassandra-0:9042 to port 9042.
- Use nginx to route traffic to specific exposed ports (9042,9043, ...) for (cassandra-0, cassandra-1, ...)
I plan to make test from localhost using pods in kubernetes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论