简体   繁体   English

使用kubectl proxy命令直接访问app

[英]Using Kubectl proxy command to access app directly

First of all I just want to say that I just recently began working with Kubernetes and I'm sorry in advance if it is a stupid question.首先,我只想说我最近才开始使用 Kubernetes,如果这是一个愚蠢的问题,我提前道歉。

So currently using Kubernetes on AWS EKS.所以目前在 AWS EKS 上使用 Kubernetes。 I'm able to access my app from localhost by using the command:我可以使用以下命令从本地主机访问我的应用程序:

kubectl proxy --port 9980

But to access my app, the url is something like:但是要访问我的应用程序,网址类似于:

127.0.0.1:9980/api/v1/namespaces/NAMESPACE/pods/POD/proxy/MY_API_PATH

My question is: Is there way to get rid of the /api/v1/namespaces/NAMESPACE/pods/POD/proxy and be able to access my app only with: 127.0.0.1:9980/MY_API_PATH ?我的问题是:有没有办法摆脱/api/v1/namespaces/NAMESPACE/pods/POD/proxy并且只能通过以下方式访问我的应用程序: 127.0.0.1:9980/MY_API_PATH

Thank you.谢谢你。

Thanks to @DavidMaze, after documenting myself on the kubectl port-forward I found what I was looking for.感谢@DavidMaze,在kubectl port-forward上记录了我自己之后,我找到了我要找的东西。

Now I understand why I couldn't find a direct answer, it is obvious.现在我明白为什么我找不到直接的答案了,这是显而易见的。

What I did is just:我所做的只是:

kubectl port-forward pods/POD_NAME 9980:8080

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM