kubernetes dashboard 2.0.5 简易部署
1、下载dashboard部署文件wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.3/aio/deploy/recommended.yaml2、修改yml ,service对外开放访问端口30001kind: Service...k8s-app: kubernetes-dashboard...spec:type: N
·
1、下载dashboard部署文件
wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.5/aio/deploy/recommended.yaml
2、修改yml ,service对外开放访问端口30001
kind: Service
...
k8s-app: kubernetes-dashboard
...
spec:
type: NodePort #修改
ports:
- port: 443
targetPort: 8443
nodePort: 30001 #修改
3、修改yml,修改默认账号权限
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kubernetes-dashboard
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin #修改
subjects:
- kind: ServiceAccount
name: kubernetes-dashboard
namespace: kubernetes-dashboard
4、由于默认的token超时时间很短,可以手动修改token有效时间
spec:
containers:
- name: kubernetes-dashboard
image: kubernetesui/dashboard:v2.0.5
imagePullPolicy: Always
ports:
- containerPort: 8443
protocol: TCP
args:
- --auto-generate-certificates
- --namespace=kubernetes-dashboard
- --token-ttl=86400 #修改为24小时
5、部署dashboard
kubectl apply -f recommended.yaml
5、选择使用token登录
6、 使用命令获取登陆token
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep kubernetes-dashboard | awk '{print $1}')
7、成功登入
7、添加cpu与内存实时监控信息
*默认安装时没有cpu内存等指标监控的
*dashboard 2.0+添加cpu内存等指标监控,需要使用metrics-server
下载配置文件(当前版本V0.4.1)
wget https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.4.1/components.yaml -O metrics-server-0.4.1.yml
*由于国内无法下载配置文件中的指定的镜像,所以修改一下镜像配置,使其在国内也能下载
*新增一些参数项,具体参考: https://github.com/kubernetes-sigs/metrics-server
containers:
- name: metrics-server
# image: k8s.gcr.io/metrics-server/metrics-server:v0.4.1 #原镜像
image: bitnami/metrics-server:0.4.1 #修改后镜像
imagePullPolicy: IfNotPresent
args:
- --cert-dir=/tmp
- --secure-port=4443
- --kubelet-preferred-address-types=InternalIP #新增
- --kubelet-insecure-tls #新增
ports:
*部署metrics-server
kubectl apply -f metrics-server-0.4.1.yml
*修改 kube-apiserver.yaml
vi /etc/kubernetes/manifests/kube-apiserver.yaml
*添加如下参数
spec:
containers:
- command:
- kube-apiserver
...
- --enable-aggregator-routing=true #新增
重新登陆即可看到cpu与内存等信息
更多推荐
已为社区贡献1条内容
所有评论(0)