代理后面的kubectl

编程入门 行业动态 更新时间:2024-10-11 23:19:38
本文介绍了代理后面的kubectl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已按照此处的说明,使用minikube安装了本地Kubernetes集群.

I have installed a local Kubernetes cluster using minikube following the instructions here.

我在公司代理人的陪同下.因此,我已经设置了http_proxy和https_proxy环境变量.在minikube start命令之后启动集群后,我还将minikube ip的值添加到了no_proxy env var中.但是,kubectl仍然无法连接到集群.

I'm under a corporate proxy. Therefore I have set the http_proxy and https_proxy env vars. Once the cluster is started after minikube start command I also added the value of minikube ip to the no_proxy env var. However still kubectl cannot connect to the cluster.

ubuntu@ros-2:~$ kubectl -v=7 get pods I0105 10:31:47.773801 17607 loader.go:354] Config loaded from file /home/ubuntu/.kube/config I0105 10:31:47.775151 17607 round_trippers.go:296] GET 192.168.42.22:8443/api I0105 10:31:47.778533 17607 round_trippers.go:303] Request Headers: I0105 10:31:47.778606 17607 round_trippers.go:306] Accept: application/json, */* I0105 10:31:47.778676 17607 round_trippers.go:306] User-Agent: kubectl/v1.5.1 (linux/amd64) kubernetes/82450d0 I0105 10:31:47.783069 17607 round_trippers.go:321] Response Status: in 4 milliseconds I0105 10:31:47.783166 17607 helpers.go:221] Connection error: Get 192.168.42.22:8443/api: Forbidden port F0105 10:31:47.783181 17607 helpers.go:116] Unable to connect to the server: Forbidden port

我认为这是因为kubectl不了解no_proxy设置.对群集进行简单的卷曲就可以了.

I'm assuming this is because of kubectl not being aware of the no_proxy settings. A simple curl to the cluster goes through fine.

ubuntu@ros-2:~$ curl -v -k 192.168.42.22:8443/api * Hostname was NOT found in DNS cache * Trying 192.168.42.22... * Connected to 192.168.42.22 (192.168.42.22) port 8443 (#0) * successfully set certificate verify locations: * CAfile: none CApath: /etc/ssl/certs * SSLv3, TLS handshake, Client hello (1): * SSLv3, TLS handshake, Server hello (2): * SSLv3, TLS handshake, CERT (11): * SSLv3, TLS handshake, Server key exchange (12): * SSLv3, TLS handshake, Request CERT (13): * SSLv3, TLS handshake, Server finished (14): * SSLv3, TLS handshake, CERT (11): * SSLv3, TLS handshake, Client key exchange (16): * SSLv3, TLS change cipher, Client hello (1): * SSLv3, TLS handshake, Finished (20): * SSLv3, TLS change cipher, Client hello (1): * SSLv3, TLS handshake, Finished (20): * SSL connection using ECDHE-RSA-AES128-GCM-SHA256 * Server certificate: * subject: CN=minikube * start date: 2017-01-04 16:04:47 GMT * expire date: 2018-01-04 16:04:47 GMT * issuer: CN=minikubeCA * SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway. > GET /api HTTP/1.1 > User-Agent: curl/7.35.0 > Host: 192.168.42.22:8443 > Accept: */* > < HTTP/1.1 401 Unauthorized < Content-Type: text/plain; charset=utf-8 < X-Content-Type-Options: nosniff < Date: Thu, 05 Jan 2017 10:33:45 GMT < Content-Length: 13 < Unauthorized * Connection #0 to host 192.168.42.22 left intact

关于如何解决此问题的任何想法?

Any ideas on how to fix this?

推荐答案

已解决此问题.解决方法是在NO_PROXY中也包含no_proxy详细信息.

Fixed this. The fix was to have the no_proxy details in NO_PROXY as well.

export NO_PROXY=$no_proxy,$(minikube ip)

相关线程.希望这对某人有用.

Relevant thread. Hope this will be useful to someone.

更多推荐

代理后面的kubectl

本文发布于:2023-11-14 17:51:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1588142.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:kubectl

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!