查看集群信息报错

1
2
3
4
[root@gzzsg-test-k8smaster03 ~]# kubectl cluster-info

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
The connection to the server localhost:8080 was refused - did you specify the right host or port?

原因分析:

  • 1、apiserver启动时候端没有开启8080
  • 2、配置文件设置为–insecure-port=0

解决方案:

  • 1、开启8080端口 –insecure-port=8080
  • 2、指定~/.kube/config
    复制kubernetes 部署 dashboard 插件中创建使用 token 的 KubeConfig 文件内容到~/.kube/config即可
    1
    2
    3
    4
    5
    [root@gzzsg-test-k8smaster01 cfg]# kubectl  cluster-info
    Kubernetes master is running at https://k8s-api-test.xxx.com:8443
    kubernetes-dashboard is running at https://k8s-api-test.xxx.com:8443/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy

    To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

Comments

2019-03-24