Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is the schema of the api server url fixed to HTTPS,can it support configurable features? #1476

Closed
Tian90coder opened this issue Apr 22, 2024 · 6 comments

Comments

@Tian90coder
Copy link

const HTTPS: &str = "https";

@Tian90coder
Copy link
Author

I found an environment variable: KUBE_RS_DEBUG_OVERRIDE_URL that can solve the problem

https://github.com/kube-rs/kube/blob/main/kube-client/src/config/mod.rs#L339

@clux
Copy link
Member

clux commented Apr 22, 2024

huh, thanks for the post. i am not sure whether or not this is a bug or not.

in particular i would have expected the else branch in that fn to return http on non-443 ports, but maybe non-https apiserver access is generally not something that is available? Are you doing some type of local development?

(The KUBE_RS_DEBUG_OVERRIDE_URL solution would technically work, but it is a bit of a hack. You can use Config to set the cluster_url directly before using the Config to create a Client.)

@nightkr
Copy link
Member

nightkr commented Apr 22, 2024

Pretty sure the apiserver intentionally dropped plaintext HTTP support a while ago. This is also only relevant to incluster, Kubeconfig does support plaintext HTTP.

That said, it seems completely pointless to keep singling out all those port == 443 cases, including the default port should be completely harmless to any reasonable client.

@Tian90coder
Copy link
Author

huh, thanks for the post. i am not sure whether or not this is a bug or not.呵呵,谢谢你的帖子。 我不确定这是否是一个错误。

in particular i would have expected the else branch in that fn to return http on non-443 ports, but maybe non-https apiserver access is generally not something that is available? Are you doing some type of local development?特别是,我本来希望该 FN 中的 else 分支在非 443 端口上返回 HTTP,但也许非 HTTPS apiserver 访问通常不可用?您是否正在进行某种类型的本地开发?

(The KUBE_RS_DEBUG_OVERRIDE_URL solution would technically work, but it is a bit of a hack. You can use Config to set the cluster_url directly before using the Config to create a Client.)(该 KUBE_RS_DEBUG_OVERRIDE_URL 解决方案在技术上是可行的,但它有点黑客。 Config 您可以使用直接设置 cluster_url ,然后再使用 创建 ConfigClient.

ok, thanks, in my case, the k8s api server only support http, i will try to use it (Config)

@Tian90coder
Copy link
Author

Pretty sure the apiserver intentionally dropped plaintext HTTP support a while ago. This is also only relevant to incluster, Kubeconfig does support plaintext HTTP.可以肯定的是,apiserver 前段时间故意放弃了对明文 HTTP 的支持。这也只与集群相关,Kubeconfig 确实支持明文 HTTP。

That said, it seems completely pointless to keep singling out all those port == 443 cases, including the default port should be completely harmless to any reasonable client.也就是说,继续挑出所有这些 port == 443 情况似乎完全没有意义,包括默认端口应该对任何合理的客户端完全无害。

Can't agree any more, https will become a strict standards.

@nightkr
Copy link
Member

nightkr commented Apr 22, 2024

All that said, please don't use plaintext K8s outside of local testing. Exposing plaintext K8s is like exposing unencrypted telnet. It's remote code execution with no ifs or buts around it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants