kubectl 命令给出错误
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
因为那是我机器的IP,所以我想到了运行这样的命令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
是供应系统放置你的配置的位置,但它不是 kubectl 默认使用的位置。 kubectl 查看配置的通常位置是 ~/.kube/config
所以要么将你的配置文件放在那里,要么提示 kubectl 它需要使用 --kubeconfig <path>
参数在不同的地方查看。
没有问题如果你:
curl https://127.0.0.1:10252/healthz -k
return 是 OK
Unable to connect to the server: net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x15\x03\x01\x00\x02\x02"
该错误是因为缺少 --server
arg https://
。应该是这样的:
kubectl get pods --server=https://10.23.23.19:6443
您可能会在添加 https://
后收到 403 错误,因为仍然没有定义身份验证,但这是格式错误的 HTTP 响应的原因。
我的所有 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
因为那是我机器的IP,所以我想到了运行这样的命令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
是供应系统放置你的配置的位置,但它不是 kubectl 默认使用的位置。 kubectl 查看配置的通常位置是 ~/.kube/config
所以要么将你的配置文件放在那里,要么提示 kubectl 它需要使用 --kubeconfig <path>
参数在不同的地方查看。
没有问题如果你:
curl https://127.0.0.1:10252/healthz -k
return 是 OK
Unable to connect to the server: net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x15\x03\x01\x00\x02\x02"
该错误是因为缺少 --server
arg https://
。应该是这样的:
kubectl get pods --server=https://10.23.23.19:6443
您可能会在添加 https://
后收到 403 错误,因为仍然没有定义身份验证,但这是格式错误的 HTTP 响应的原因。