通过 Helm Chart 部署的 Rook 默认就已经启用了 Ceph Dashboard,相关的设置在 cephclusters.ceph.rook.io
CRD 中开启了 MGR 的 dashboard 模块。
也可以在 rook-ceph
中找到对应的 service:
[vagrant@master01 rook-ceph]$ kubectl get svc -n rook-ceph
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
rook-ceph-mgr ClusterIP 10.102.136.193 <none> 9283/TCP 26d
rook-ceph-mgr-dashboard ClusterIP 10.105.56.118 <none> 8443/TCP 26d
rook-ceph-mon-a ClusterIP 10.101.27.111 <none> 6789/TCP,3300/TCP 26d
rook-ceph-mon-b ClusterIP 10.106.190.243 <none> 6789/TCP,3300/TCP 26d
rook-ceph-mon-c ClusterIP 10.107.18.191 <none> 6789/TCP,3300/TCP 26d
rook-ceph-mgr-dashboard
就是对应 dashboard 的 service,要想从外部访问的话需要暴露该 service,可以有多种方式,例如 NodePort,如果有 ingress 的话也可以创建 ingress 资源,例如使用以下 Yaml 定义:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: rook-ceph-mgr-dashboard
namespace: rook-ceph
annotations:
kubernetes.io/tls-acme: "true"
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
nginx.ingress.kubernetes.io/server-snippet: |
proxy_ssl_verify off;
spec:
ingressClassName: "nginx"
tls:
- hosts:
- rook-ceph.example.com
secretName: rook-ceph.example.com
rules:
- host: rook-ceph.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: rook-ceph-mgr-dashboard
port:
name: https-dashboard
创建成功后,就可以通过浏览器进行登录了:
[vagrant@master01 rook-ceph]$ kubectl get ingress -n rook-ceph
NAME CLASS HOSTS ADDRESS PORTS AGE
rook-ceph-mgr-dashboard nginx rook-ceph.example.com 80, 443 63m
使用的用户名为 admin
,密钥可以通过以下方式进行获取:
kubectl -n rook-ceph get secret rook-ceph-dashboard-password -o jsonpath="{['data']['password']}" | base64 --decode && echo
登录后的界面: