安完kubernetes了,为了方便就整一个dashboard,恰好看了看dashboard的2.0的bete8出来了,直接就开整,看看新UI到底咋样
先看看已有的环境(昨天搞的环境)

首先就要搞个证书,我就直接用我XX云的了,然后取名dashboard.crt和dashboard.key,放置到下面这个目录里面
# mkdir $HOME/certs
创建一个namespace
# kubectl create namespace kubernetes-dashboard
创建SSL证书的secret
# kubectl create secret generic kubernetes-dashboard-certs –from-file=$HOME/certs -n kubernetes-dashboard
下载Beta8的recommended.yaml
# wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta8/aio/deploy/recommended.yaml
修改某些参数,为了部落
# vim recommended.yaml
spec: ports: - port: 443 targetPort: 8443 selector: k8s-app: kubernetes-dashboard 改成 spec: type: NodePort # 新增可以外网访问 ports: - port: 443 targetPort: 8443 nodePort: 30016 # 新增可以外网访问 selector: k8s-app: kubernetes-dashboard

将下面的全部注释 apiVersion: v1 kind: Secret metadata: labels: k8s-app: kubernetes-dashboard name: kubernetes-dashboard-certs namespace: kubernetes-dashboard type: Opaque

- --auto-generate-certificates - --namespace=kubernetes-dashboard 改成: # - --auto-generate-certificates - --tls-cert-file=/dashboard.crt - --tls-key-file=/dashboard.key - --token-ttl=3600 - --namespace=kubernetes-dashboard

修改完成后就开始创建
# kubectl apply -f recommended.yaml

创建管理员权限
# vim admin.yaml
apiVersion: v1 kind: ServiceAccount metadata: name: admin-user namespace: kubernetes-dashboard apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding metadata: name: admin-user annotations: rbac.authorization.kubernetes.io/autoupdate: "true" roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: kind: ServiceAccount name: admin-user namespace: kubernetes-dashboard
# kubectl apply -f admin.yaml
查一下token值
# kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk ‘{print $1}’)
打开IP:30016端口,输入刚才查出来的token,最炫暗黑模式搞起


搞定
卸载dashboard两个方法:
方法一:直接执行delete命令
# kubectl delete -f recommended.yaml
方法二:
# kubectl -n kubernetes-dashboard delete $(kubectl -n kubernetes-dashboard get pod -o name | grep dashboard)
注意: namespace 是自己设置的,有用kube-system的,我用的kubernetes-dashboard
Hey I know this is off topic but I was wondering
if you knew of any widgets I could add to my blog that automatically tweet my newest twitter updates.
I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this.
Please let me know if you run into anything. I truly enjoy reading your
blog and I look forward to your new updates.
Just wish to say your article is as astounding.
The clearness to your put up is simply spectacular and that i could assume you’re an expert on this subject.
Fine along with your permission allow me to seize your RSS feed to stay up to date with drawing close post.
Thank you 1,000,000 and please keep up the enjoyable work.
Hi there! I just wanted to ask if you ever have any trouble with hackers?
My last blog (wordpress) was hacked and I ended up losing several weeks of hard work due
to no backup. Do you have any solutions to prevent hackers?
It is in point of fact a great and helpful piece of info.
I am glad that you simply shared this useful info with us.
Please keep us informed like this. Thank you for sharing.
I have read so many articles or reviews about the blogger
lovers but this paragraph is actually a nice article, keep it
up.