[英]kubectl commands giving error
我所有的kubectl get
命令都失敗,並出現以下錯誤The connection to the server localhost:8080 was refused - did you specify the right host or port?
我檢查了我的/etc/kubernetes/admin.conf
的IP,它與其他內容相比有以下區別: server: https://10.23.23.19:6443
: /etc/kubernetes/admin.conf
因為那是我機器的IP,所以我kubectl get pods --server=10.23.23.19:6443
這樣運行命令kubectl get pods --server=10.23.23.19:6443
上面給了我錯誤- Unable to connect to the server: net/http: HTTP/1.x transport connection broken: malformed HTTP response "\\x15\\x03\\x01\\x00\\x02\\x02"
我究竟做錯了什么? 我有一個3節點群集,所有這些都在主服務器上。 當另外2個節點加入時,它們確實成功加入了,但我在屏幕上看到的是狀態。
我使用了本教程(開始時略有偏差) -https://www.linuxtechi.com/install-kubernetes-1-7-centos7-rhel7/
/etc/kubernetes/admin.conf
是/etc/kubernetes/admin.conf
配置系統將您的配置放入的位置,但默認情況下不是kubectl使用的位置。 kubectl通常將其放在~/.kube/config
因此請將您的配置文件放在此處,或提示kubectl需要使用--kubeconfig <path>
參數在其他位置--kubeconfig <path>
。
如果您:
curl https://127.0.0.1:10252/healthz -k
還OK
無法連接到服務器:net / http:HTTP / 1.x傳輸連接斷開:格式錯誤的HTTP響應“ \\ x15 \\ x03 \\ x01 \\ x00 \\ x02 \\ x02”
該錯誤是因為--server
arg缺少https://
。 應該是這樣的:
kubectl get pods --server=https://10.23.23.19:6443
添加https://
后,您可能會收到403錯誤,因為仍然沒有定義auth,但這是導致HTTP響應格式錯誤的原因。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.