kubeadm安装k8s v1.13.1 HA详细教程之五:安装dashboard
本文首发自个人博客:https://blog.smile13.com/articles/2019/01/14/1547457021341.html此操作在任意一个master上进行1.下载配置文件wget https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended/kube...
·
本文首发自个人博客:https://blog.smile13.com/articles/2019/01/14/1547457021341.html
此操作在任意一个master上进行
1.下载配置文件
wget https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended/kubernetes-dashboard.yaml
2.修改配置文件
------------------- Dashboard Deployment -------------------
containers:
- name: kubernetes-dashboard
imagePullPolicy: IfNotPresent
image: registry.cn-hangzhou.aliyuncs.com/google_containers/kubernetes-dashboard-amd64:v1.10.1
# ------------------- Dashboard Service ------------------- #
kind: Service
apiVersion: v1
metadata:
labels:
k8s-app: kubernetes-dashboard
name: kubernetes-dashboard
namespace: kube-system
spec:
type: NodePort
ports:
- port: 443
targetPort: 8443
nodePort: 30080
selector:
k8s-app: kubernetes-dashboard
3.部署kubernetes-dashboard
kubeadm-config.yaml kubernetes-dashboard.yaml [root@k8s01 k8s-install]# kubectl create -f kubernetes-dashboard.yaml secret/kubernetes-dashboard-certs created serviceaccount/kubernetes-dashboard created role.rbac.authorization.k8s.io/kubernetes-dashboard-minimal created rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard-minimal created deployment.apps/kubernetes-dashboard created service/kubernetes-dashboard created
4.查看dashboard部署情况
[root@k8s01 k8s-install]# kubectl get pods -n kube-system NAME READY STATUS RESTARTS AGE calico-node-4sffv 2/2 Running 0 39m calico-node-b2t47 2/2 Running 0 95m calico-node-fp2dm 2/2 Running 0 30m calico-node-l4ft8 2/2 Running 0 105m calico-node-r75hl 2/2 Running 0 28m calico-node-z8sjp 2/2 Running 0 100m coredns-89cc84847-rdkcl 1/1 Running 0 108m coredns-89cc84847-rqzxq 1/1 Running 0 108m etcd-k8s01 1/1 Running 1 107m etcd-k8s02 1/1 Running 1 100m etcd-k8s03 1/1 Running 1 95m kube-apiserver-k8s01 1/1 Running 0 107m kube-apiserver-k8s02 1/1 Running 0 100m kube-apiserver-k8s03 1/1 Running 0 95m kube-controller-manager-k8s01 1/1 Running 6 107m kube-controller-manager-k8s02 1/1 Running 6 100m kube-controller-manager-k8s03 1/1 Running 3 95m kube-proxy-2vwcs 1/1 Running 0 28m kube-proxy-h4f4s 1/1 Running 0 100m kube-proxy-kvkhc 1/1 Running 0 95m kube-proxy-qjnls 1/1 Running 0 30m kube-proxy-zkfv4 1/1 Running 0 108m kube-proxy-zvnp7 1/1 Running 0 39m kube-scheduler-k8s01 1/1 Running 9 107m kube-scheduler-k8s02 1/1 Running 5 100m kube-scheduler-k8s03 1/1 Running 4 95m kubernetes-dashboard-697f86d999-dz75w 1/1 Running 0 116s 如果创建不对的话可以使用kubectl delete -f kubernetes-dashboard.yaml删掉,然后重新创建
5.创建serviceaccount 用于登陆dashboard
kubectl create serviceaccount dashboard-admin -n kube-system
6.创建clusterrolebinding
kubectl create clusterrolebinding cluster-dashboard-admin --clusterrole=cluster-admin --serviceaccount=kube-system:dashboard-admin
7.查看生成的secret的token
###查看secret
[root@k8s01 ~]# kubectl get secret -n kube-system|grep dashboard-admin
dashboard-admin-token-4z7zs kubernetes.io/service-account-token 3 27s
>
###根据secret名称查找token
[root@k8s01 ~]# kubectl describe secret dashboard-admin-token-4z7zs -n kube-system
Name: dashboard-admin-token-4z7zs
Namespace: kube-system
Labels: <none>
Annotations: kubernetes.io/service-account.name: dashboard-admin
kubernetes.io/service-account.uid: ab39b60b-19a2-11e9-9579-525400837d49
Type: kubernetes.io/service-account-token
Data
====
namespace: 11 bytes
token: eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3Bhxxxxxxxxxxx...(省略)
ca.crt: 1025 bytes
8.登录dashboard(使用firefox)
打开对应的地址(https://192.168.158.138:30080),选择token登录,使用上面的token登录即可。
版权声明:本文为博主原创文章,转载请注明出处!
更多推荐
已为社区贡献3条内容
所有评论(0)