我的主节点ip地址是192.168.56.101.有没有节点连接到master呢。
master@kmaster:~$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
kmaster Ready master 125m v1.15.1
master@kmaster:~$
当我使用下面的命令部署我的kubernetes-dashborad,为什么运行kubernetes-dashboard-5c8f9556c4-f2jpz的IP地址192.168.189.6同样,其他pod也有不同的IP地址。
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta1/aio/deploy/recommended.yaml
master@kmaster:~$ kubectl get pods -o wide --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
kube-system calico-kube-controllers-7bd78b474d-r2bwg 1/1 Running 0 113m 192.168.189.2 kmaster <none> <none>
kube-system calico-node-dsgqt 1/1 Running 0 113m 192.168.56.101 kmaster <none> <none>
kube-system coredns-5c98db65d4-n2wml 1/1 Running 0 114m 192.168.189.3 kmaster <none> <none>
kube-system coredns-5c98db65d4-v5qc8 1/1 Running 0 114m 192.168.189.1 kmaster <none> <none>
kube-system etcd-kmaster 1/1 Running 0 114m 192.168.56.101 kmaster <none> <none>
kube-system kube-apiserver-kmaster 1/1 Running 0 114m 192.168.56.101 kmaster <none> <none>
kube-system kube-controller-manager-kmaster 1/1 Running 0 114m 192.168.56.101 kmaster <none> <none>
kube-system kube-proxy-bgtmr 1/1 Running 0 114m 192.168.56.101 kmaster <none> <none>
kube-system kube-scheduler-kmaster 1/1 Running 0 114m 192.168.56.101 kmaster <none> <none>
kubernetes-dashboard kubernetes-dashboard-5c8f9556c4-f2jpz 1/1 Running 0 107m 192.168.189.6 kmaster <none> <none>
kubernetes-dashboard kubernetes-metrics-scraper-86456cdd8f-w45w2 1/1 Running 0 107m 192.168.189.4 kmaster <none> <none>
master@kmaster:~$
也无法访问kubernetes-dashboardUI。我正在使用链接http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https: kubernetes-dashboard:/proxy/。
链接KubeDNShttps://192.168.56.101:6443/api/v1/namespaces/kube-system/services/kube-dns: dns/proxy也不起作用。
但当试图访问库伯内特斯主在https://192.168.56.101:6443工作。
master@kmaster:~$ kubectl cluster-info
Kubernetes master is running at https://192.168.56.101:6443
KubeDNS is running at https://192.168.56.101:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
任何建议。
解决方案(请参阅评论):不要混合使用物理和覆盖网络范围。
访问KubeDNS只能使用DNS作为协议,而不是HTTP。如果您想查询DNS服务,您需要kubectl端口转发,而不是HTTP(API)代理。
如果您尝试使用localhost:8081访问仪表板,则必须从控制台运行kubectl proxy-port 8081以在您localhostk8s apiserver之间设置代理。
如果您想在没有本地代理的情况下直接从apiserver访问仪表板,请尝试以下urlhttps://192.168.56.101:6443/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy(假设您的服务名称是kubernetes-dashboard)
您还可以运行kubectl port-转发svc/kubernetes-dashboard-n kubernetes-dashboard 443,然后使用https://localhost:443访问仪表板