概述
在 Fluid 中可以通过 nodeselector 来指定 master 节点的部署,例如选择部署 master 到性能较好的 k8s 机器上。
下面将向您简单地介绍上述特性。
前提条件
$ kubectl get pod -n fluid-systemgoosefsruntime-controller-5b64fdbbb-84pc6 1/1 Running 0 8hcsi-nodeplugin-fluid-fwgjh 2/2 Running 0 8hcsi-nodeplugin-fluid-ll8bq 2/2 Running 0 8hdataset-controller-5b7848dbbb-n44dj 1/1 Running 0 8h
通常来说,您会看到一个名为
dataset-controller
的 Pod、一个名为 goosefsruntime-controller
的 Pod 和多个名为csi-nodeplugin
的 Pod 正在运行。其中 csi-nodeplugin
这些 Pod 的数量取决于您的 Kubernetes 集群中结点的数量。新建工作环境
$ mkdir <any-path>/co-locality$ cd <any-path>/co-locality
示例
查看全部结点
$ kubectl get nodesNAME STATUS ROLES AGE VERSION192.168.1.146 Ready <none> 7d14h v1.18.4-tke.13192.168.1.147 Ready <none> 7d14h v1.18.4-tke.13
使用标签标识结点
$ kubectl label nodes 192.168.1.146 hbase-cache=true
再次查看结点
$ kubectl get node -L hbase-cacheNAME STATUS ROLES AGE VERSION HBASE-CACHE192.168.1.146 Ready <none> 7d14h v1.18.4-tke.13 true192.168.1.147 Ready <none> 7d14h v1.18.4-tke.13
检查待创建的 Dataset 资源对象
apiVersion: data.fluid.io/v1alpha1kind: Datasetmetadata:name: hbasespec:mounts:- mountPoint: https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/stable/name: hbase
说明
创建 Dataset 资源对象
$ kubectl create -f dataset.yamldataset.data.fluid.io/hbase created
检查待创建的 GooseFSRuntime 资源对象
apiVersion: data.fluid.io/v1alpha1kind: GooseFSRuntimemetadata:name: hbasespec:replicas: 1tieredstore:levels:- mediumtype: MEMpath: /dev/shmquota: 2Ghigh: "0.8"low: "0.7"master:nodeSelector:hbase-cache: "true"
该配置文件片段中,包含了许多与 GooseFS 相关的配置信息,这些信息将被 Fluid 用来启动一个 GooseFS 实例。上述配置片段中的
spec.replicas
属性被设置为1,这表明 Fluid 将会启动一个包含1个 GooseFS Master 和1个 GooseFS Worker 的 GooseFS 实例。创建 GooseFSRuntime 资源并查看状态
$ kubectl create -f runtime.yamlgoosefsruntime.data.fluid.io/hbase created$ kubectl get pod -o wideNAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATEShbase-fuse-42csf 1/1 Running 0 104s 192.168.1.146 192.168.1.146 <none> <none>hbase-master-0 2/2 Running 0 3m3s 192.168.1.147 192.168.1.146 <none> <none>hbase-worker-l62m4 2/2 Running 0 104s 192.168.1.146 192.168.1.146 <none> <none>
在此处可以看到,master 成功启动并且运行在具有指定标签(即
hbase-cache=true
)的结点之上。