5.7 部署istio dashboard
Naftis
是一个基于 web 的 Istio dashboard,通过任务模板的方式来帮助用户更方便地执行 Istio 任务。 用户可以在 Naftis 中定义自己的任务模板,并填充变量来构造单个或多个构造任务实例,从而完成各种服务治理功能。
Naftis的功能:
内部集成了一些常用 dashboard
可定制的任务模板支持
支持回滚指定任务
支持指定根服务节点的服务拓扑图
提供查看 Istio 的 Services 和 Pod 的支持
开箱即用,通过 Kubectl 相关指令即可快速部署
支持 Istio 1.0
github仓库地址:https://github.com/xiaomi/naftis
目前最新版本为0.1.4-rc6
部署naftis
下载最新 release 文件和部署清单
wget -O - https://raw.githubusercontent.com/XiaoMi/naftis/master/tool/getlatest.sh | bash
创建 Naftis 命名空间
kubectl create namespace naftis
确认 Naftis 命名空间已创建
kubectl get namespace naftis
NAME STATUS AGE
naftis Active 7s
修改mysql.yaml文件
cp mysql.yaml{,.ori}
diff mysql.yaml.ori mysql.yaml
10c10
< storageClassName: manual
---
> storageClassName: managed-nfs-storage
206c206
< storageClassName: "manual"
---
> storageClassName: "managed-nfs-storage"
275c275
< apiVersion: extensions/v1beta1
---
> apiVersion: apps/v1
284a285,287
> selector:
> matchLabels:
> app: naftis-mysql
部署 Naftis MySQL 服务
kubectl apply -n naftis -f mysql.yaml
persistentvolume/naftis-pv created
secret/naftis-mysql created
configmap/naftis-mysql-initialization created
configmap/naftis-mysql-test created
persistentvolumeclaim/naftis-mysql created
service/naftis-mysql created
pod/naftis-mysql-test created
deployment.apps/naftis-mysql created
确认 MySQL 已部署
kubectl get po -n naftis
NAME READY STATUS RESTARTS AGE
naftis-mysql-54444ffc5-7mp86 1/1 Running 0 33s
naftis-mysql-test 0/1 Running 0 33s
修改naftis.yaml文件
cp naftis.yaml{,.ori}
diff naftis.yaml.ori naftis.yaml
84c84
< apiVersion: extensions/v1beta1
---
> apiVersion: apps/v1
94a95,98
> selector:
> matchLabels:
> app: naftis-ui
> release: naftis
111c115
< apiVersion: extensions/v1beta1
---
> apiVersion: apps/v1
121a126,129
> selector:
> matchLabels:
> app: naftis-api
> release: naftis
部署 Naftis API 和 UI 服务
kubectl apply -n naftis -f naftis.yaml
namespace/naftis created
configmap/naftis-config created
clusterrolebinding.rbac.authorization.k8s.io/naftis-rbac created
service/naftis-api created
service/naftis-ui created
deployment.apps/naftis-ui created
deployment.apps/naftis-api created
确认 Naftis 所有的服务已经正确定义并正常运行中
kubectl get svc -n naftis
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
naftis-api ClusterIP 10.104.140.162 <none> 50000/TCP 27s
naftis-mysql ClusterIP 10.105.179.76 <none> 3306/TCP 79s
naftis-ui LoadBalancer 10.97.7.57 <pending> 80:30377/TCP 27s
kubectl get pod -n naftis
NAME READY STATUS RESTARTS AGE
naftis-api-7cbdb88f97-qrg2f 0/1 Running 0 6s
naftis-mysql-54444ffc5-8vnsq 1/1 Running 0 58s
naftis-mysql-test 0/1 Running 0 58s
naftis-ui-5f769cdbbd-85cwz 1/1 Running 0 6s
端口转发访问 Naftis
kubectl -n naftis port-forward $(kubectl -n naftis get pod -l app=naftis-ui -o jsonpath='{.items[0].metadata.name}') --address 0.0.0.0 8080:80 &
打开浏览器,访问 http://localhost:8080 即可。默认用户名和密码分别为 admin、admin。
或者修改naftis-ui
服务类型为NodePort
kubectl patch -n naftis svc naftis-ui -p '{"spec": {"type": "NodePort"}}'
service/naftis-ui patched
kubectl get svc -n naftis naftis-ui
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
naftis-ui NodePort 10.97.7.57 <none> 80:30377/TCP 6m39s
然后通过http://192.168.100.10:30377
进行访问。
页面支持中文和英文两种,具体的操作略。