- 我已经使用 kubeadm v1.8.5 设置了一个 kubernetes
- 使用以下方法设置仪表板:
wget https://raw.githubusercontent.com/kubernetes/dashboard/v1.8.0/src/deploy/recommended/kubernetes-dashboard.yaml`
kubectl create -f kubernetes-dashboard.yaml
kubectl create -f kubernetes-dashboard-admin.rbac.yaml
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
然后按照推荐使用设置 kubectl 代理。当我尝试使用 kubernetes-dashboard-admin 令牌登录时。使用以下命令接收令牌:
kubectl -n kube-system get secret | grep -i dashboard-admin | awk '{print $1}' | xargs -I {}
kubectl -n kube-system describe secret {}
我的问题来了:我无法通过令牌访问仪表板,当我粘贴令牌并单击“登录”按钮时,什么也没发生。而且我的日志中什么也没有[使用 tail -f /var/log/messages 和 journalctl -xeu kubelet]。我是k8s的新手,也许有人可以告诉我日志在哪里?
这是我的 k8s 集群信息:
[root@k8s-1 pki]#kubectl cluster-info
Kubernetes master is running at https://172.16.1.15:6443
KubeDNS is running at https://172.16.1.15:6443/api/v1/namespaces/kube-system/services/kube-dns/proxy
kubernetes-dashboard is running at https://172.16.1.15:6443/api/v1/namespaces/kube-system/services/kubernetes-dashboard/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
[root@k8s-1 pki]#kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-1 Ready master 4d v1.8.5
k8s-2 Ready <none> 4d v1.8.5
k8s-3 Ready <none> 4d v1.8.5
[root@k8s-1 pki]#kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system etcd-k8s-1 1/1 Running 2 4d
kube-system kube-apiserver-k8s-1 1/1 Running 2 4d
kube-system kube-controller-manager-k8s-1 1/1 Running 1 4d
kube-system kube-dns-545bc4bfd4-94vxx 3/3 Running 3 4d
kube-system kube-flannel-ds-97frd 1/1 Running 2 4d
kube-system kube-flannel-ds-bl9tp 1/1 Running 2 4d
kube-system kube-flannel-ds-bn9hp 1/1 Running 1 4d
kube-system kube-proxy-9ncdm 1/1 Running 0 4d
kube-system kube-proxy-qjm9k 1/1 Running 1 4d
kube-system kube-proxy-rknz4 1/1 Running 0 4d
kube-system kube-scheduler-k8s-1 1/1 Running 2 4d
kube-system kubernetes-dashboard-7486b894c6-tszq9 1/1 Running 0 2h
kubernetes-dashboard-admin-rbac.yaml 是:
[root@k8s-1 仪表板]#cat kubernetes-dashboard-admin.rbac.yaml
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
k8s-app: kubernetes-dashboard
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
name: kubernetes-dashboard-admin
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: kubernetes-dashboard-admin
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
labels:
k8s-app: kubernetes-dashboard
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: kubernetes-dashboard-admin
namespace: kube-system
有什么建议么?谢谢!!!