简体   繁体   English

访问 Kubernetes 集群中的特定 pod

[英]Accessing a specific pod in a Kubernetes cluster

In my current setup I have an application A, exposed via.在我当前的设置中,我有一个应用程序 A,通过。 NodePort, that the end-user connects to. NodePort,最终用户连接到的。 When that happens, application A then issues a kubectl command to create a static instance of another application B. When application B starts it registers itself with application A, and then runs a setup process from values given to A by the end user.发生这种情况时,应用程序 A 然后发出 kubectl 命令来创建另一个应用程序 B 的 static 实例。当应用程序 B 启动时,它向应用程序 A 注册自己,然后根据最终用户提供给 A 的值运行设置过程。

I do this, since i need to run a stateful application that users can connect to, without being loadbalanced in any way.我这样做是因为我需要运行一个用户可以连接的有状态应用程序,而无需以任何方式进行负载平衡。 However, I cannot figure out how to expose this Pod externally.但是,我无法弄清楚如何在外部公开这个 Pod。

I tried setting: hostNetwork: true and then start a TcpListener on a specific port, that I then give to Application A, that in return gives this to the end user.我尝试设置: hostNetwork: true ,然后在特定端口上启动一个 TcpListener,然后将其提供给应用程序 A,然后将其提供给最终用户。 However, this doesn't seem to expose my pod, so I might have misunderstood how it works.但是,这似乎并没有暴露我的 pod,所以我可能误解了它的工作原理。

tl;dr: Is there any approach to exposing a dynamically created static pod externally in Kubernetes? tl; dr:有什么方法可以在 Kubernetes 中从外部公开动态创建的 static pod?

I'm running my cluster with Microk8s on Ubuntu, if that has anything to say.如果有什么要说的话,我在 Ubuntu 上使用 Microk8s 运行我的集群。

Turns out my port-forward had broken due to some settings on my router being reset, and therefore I couldn't access my pod externally.结果我的端口转发由于路由器上的某些设置被重置而损坏,因此我无法从外部访问我的 pod。 Now everything works exactly as I want it to.现在一切都完全按照我的意愿工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Kubernetes pod 作为特定 IP 的网关? - How to use a Kubernetes pod as a gateway to specific IPs? Kubernetes - 服务群集IP地址与Pod IP地址 - Kubernetes - service cluster IP address vs Pod IP address 在Kubernetes设置中从Pod的集群中的Tcpdump(在Minikube设置中) - Tcpdump from a pod for cluster in kubernetes setup (In Minikube setup) Kubernetes集群中的每个Pod /容器是否都有不同的外部IP? - Does each pod/container in a Kubernetes cluster has a different external ip? 在kube.netes中,Cluster IP的用法可以替代Pod IP的用法吗? - In Kubernetes, usage of Cluster IP can replace the usage of Pod IP? 从 pod 到 Kubernetes 集群外的服务时,源 IP(记录在服务端,集群外)? - Source IP(recorded at service end, outside cluster) when talking from pod to a service outside Kubernetes cluster? 为特定 IP 和端口路由 kubernetes pod 传出流量 - route kubernetes pod outgoing traffic for a specific IP and port Pod 到 Pod 通信在 kubernetes 中不起作用 - Pod to Pod communication is not working in kubernetes Kubernetes pod 如何连接到与主机在同一本地网络(集群外)中运行的数据库? - How can a Kubernetes pod connect to database which is running in the same local network (outside the cluster) as the host? Kubernetes Pod 中的 OpenVPN 客户端 - OpenVPN Client in Kubernetes Pod
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM