The connection to the server localhost:8080 was refused - did you specify the right host or port?

执行命令:sshpass -p XXX ssh [email protected] "kubectl create -f /root/nginx-deploy.yaml"

报错:

W1208 02:50:04.426384    4100 factory_object_mapping.go:423] Failed to download OpenAPI (Get http://localhost:8080/swagger-2.0.0.pb-v1: dial tcp [::1]:8080: getsockopt: connection refused), falling back to swagger
The connection to the server localhost:8080 was refused - did you specify the right host or port?

 

解决方法:

需要开启api server 代理端口:

查看端口是否代理:curl localhost:8080/api

开启端口代理:kubectl proxy --port=8080 &

参考:https://yq.aliyun.com/articles/149595

你可能感兴趣的:(docker/k8s)