k8s-master-2-集群搭完后管理操作-文档 2-flannel 和 dashboard
1.等各个 node 都加入集群后,master 上的管理操作(需要等到所有 node 节点都 join 加入集群再操作)
查看 flannel 在各个节点的部署,自动的,因为 yaml 文件是 daemonset 类型:
[root@master ~]# kubectl get pod -o wide -n kube-system |grep flannel
kube-flannel-ds-amd64-7hrwk 1/1 Running 0 6m57s 192.168.171.128 master <none> <none>
kube-flannel-ds-amd64-hvrgx 1/1 Running 0 6m57s 192.168.171.129 node1 <none> <none>
kube-flannel-ds-amd64-lsq72 1/1 Running 0 6m57s 192.168.171.130 node2 <none> <none>
[root@master ~]# kubectl get nodes #只要集群加入成功且 flannel 网络都成功,就为 ready 状态
NAME STATUS ROLES AGE VERSION
master Ready master 33m v1.14.2
node1 Ready <none> 28m v1.14.2
node2 Ready <none> 26m v1.14.2
[root@master ~]# kubectl get cs
NAME STATUS MESSAGE ERROR
scheduler Healthy ok
controller-manager Healthy ok
etcd-0 Healthy {"health":"true"}
[root@master ~]# kubectl create deployment nginx --image=nginx #创建一个 nginx 容器
deployment.apps/nginx created
[root@master ~]# kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-65f88748fd-gt5nh 1/1 Running 0 5m7s 10.244.1.3 node1 <none> <none>
[root@master ~]# kubectl get deploy -o wide
NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
nginx 1/1 1 1 5m12s nginx nginx app=nginx
2.部署 dashboard:
[root@master ~]# wget https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
[root@master ~]# rz
上传 dashboard 镜像和 yaml 文件
[root@master ~]# ls kubernetes-dashboard*
kubernetes-dashboard-amd64_v1.10.1.tar kubernetes-dashboard.yaml
[root@master ~]# docker load -i kubernetes-dashboard-amd64_v1.10.1.tar #导入 dashboard 镜像,其他节点也导入
[root@master ~]# docker images |grep dashboard
registry.cn-hangzhou.aliyuncs.com/google_containers/kubernetes-dashboard-amd64 v1.10.1 f9aed6605b81 11 months ago 122MB
k8s.gcr.io/kubernetes-dashboard-amd64 v1.10.0 0dab2435c100 15 months ago 122MB
[root@master ~]# cat kubernetes-dashboard.yaml #不用修改
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0