写点什么

ceph-csi 源码分析(2)- 组件启动参数分析

用户头像
良凯尔
关注
发布于: 2021 年 04 月 24 日
ceph-csi源码分析(2)-组件启动参数分析

kubernetes ceph-csi 分析 - 目录导航https://xie.infoq.cn/article/4b1d3e32f124307a49cd9c1e3


ceph-csi 源码分析(2)-组件启动参数分析

ceph-csi 组件的源码分析分为五部分:


(1)组件介绍与部署 yaml 分析;


(2)组件启动参数分析;


(3)rbd driver 分析;


(4)cephfs driver 分析;


(5)liveness driver 分析。


本文将对 ceph-csi 组件的启动参数进行分析。


基于 tag v3.0.0


https://github.com/ceph/ceph-csi/releases/tag/v3.0.0

ceph-csi 组件启动参数列表

rbd 驱动参数列表参考:https://github.com/ceph/ceph-csi/blob/devel/docs/deploy-rbd.md


cephfs 驱动参数列表参考:https://github.com/ceph/ceph-csi/blob/devel/docs/deploy-cephfs.md


下面结合 ceph-csi 源码对组件启动参数进行分析。


const (  rbdType      = "rbd"  cephfsType   = "cephfs"  livenessType = "liveness"
rbdDefaultName = "rbd.csi.ceph.com" cephfsDefaultName = "cephfs.csi.ceph.com" livenessDefaultName = "liveness.csi.ceph.com"
pollTime = 60 // seconds probeTimeout = 3 // seconds)
var ( conf util.Config)
func init() { // common flags flag.StringVar(&conf.Vtype, "type", "", "driver type [rbd|cephfs|liveness]") flag.StringVar(&conf.Endpoint, "endpoint", "unix://tmp/csi.sock", "CSI endpoint") flag.StringVar(&conf.DriverName, "drivername", "", "name of the driver") flag.StringVar(&conf.NodeID, "nodeid", "", "node id") flag.StringVar(&conf.InstanceID, "instanceid", "", "Unique ID distinguishing this instance of Ceph CSI among other"+ " instances, when sharing Ceph clusters across CSI instances for provisioning") flag.IntVar(&conf.PidLimit, "pidlimit", 0, "the PID limit to configure through cgroups") flag.BoolVar(&conf.IsControllerServer, "controllerserver", false, "start cephcsi controller server") flag.BoolVar(&conf.IsNodeServer, "nodeserver", false, "start cephcsi node server") flag.StringVar(&conf.DomainLabels, "domainlabels", "", "list of kubernetes node labels, that determines the topology"+ " domain the node belongs to, separated by ','")
// cephfs related flags flag.BoolVar(&conf.ForceKernelCephFS, "forcecephkernelclient", false, "enable Ceph Kernel clients on kernel < 4.17 which support quotas")
// liveness/grpc metrics related flags flag.IntVar(&conf.MetricsPort, "metricsport", 8080, "TCP port for liveness/grpc metrics requests") flag.StringVar(&conf.MetricsPath, "metricspath", "/metrics", "path of prometheus endpoint where metrics will be available") flag.DurationVar(&conf.PollTime, "polltime", time.Second*pollTime, "time interval in seconds between each poll") flag.DurationVar(&conf.PoolTimeout, "timeout", time.Second*probeTimeout, "probe timeout in seconds")
flag.BoolVar(&conf.EnableGRPCMetrics, "enablegrpcmetrics", false, "[DEPRECATED] enable grpc metrics") flag.StringVar(&conf.HistogramOption, "histogramoption", "0.5,2,6", "[DEPRECATED] Histogram option for grpc metrics, should be comma separated value, ex:= 0.5,2,6 where start=0.5 factor=2, count=6")
flag.UintVar(&conf.RbdHardMaxCloneDepth, "rbdhardmaxclonedepth", 8, "Hard limit for maximum number of nested volume clones that are taken before a flatten occurs") flag.UintVar(&conf.RbdSoftMaxCloneDepth, "rbdsoftmaxclonedepth", 4, "Soft limit for maximum number of nested volume clones that are taken before a flatten occurs") flag.UintVar(&conf.MaxSnapshotsOnImage, "maxsnapshotsonimage", 450, "Maximum number of snapshots allowed on rbd image without flattening") flag.BoolVar(&conf.SkipForceFlatten, "skipforceflatten", false, "skip image flattening if kernel support mapping of rbd images which has the deep-flatten feature")
flag.BoolVar(&conf.Version, "version", false, "Print cephcsi version information")
klog.InitFlags(nil) if err := flag.Set("logtostderr", "true"); err != nil { klog.Exitf("failed to set logtostderr flag: %v", err) } flag.Parse()}
复制代码

deployment:csi-rbdplugin 容器部署的启动参数配置

deployment:csi-rbdplugin 容器实际上是 rbdType-ControllerServer 服务,主要负责创建、删除 rbd 存储等操作。


          args:            - "--nodeid=$(NODE_ID)"            - "--type=rbd"            - "--controllerserver=true"            - "--endpoint=$(CSI_ENDPOINT)"            - "--v=5"            - "--drivername=rbd.csi.ceph.com"            - "--pidlimit=-1"            - "--rbdhardmaxclonedepth=8"            - "--rbdsoftmaxclonedepth=4"          env:            - name: NODE_ID              valueFrom:                fieldRef:                  fieldPath: spec.nodeName            - name: CSI_ENDPOINT              value: unix:///csi/csi-provisioner.sock
复制代码

daemonset:csi-rbdplugin 容器部署的启动参数配置

daemonset:csi-rbdplugin 容器实际上是 rbdType-NodeServer 服务,主要负责 rbd 存储的挂载、解除挂载等操作。


          args:            - "--nodeid=$(NODE_ID)"            - "--type=rbd"            - "--nodeserver=true"            - "--endpoint=$(CSI_ENDPOINT)"            - "--v=5"            - "--drivername=rbd.csi.ceph.com"          env:            - name: NODE_ID              valueFrom:                fieldRef:                  fieldPath: spec.nodeName            - name: CSI_ENDPOINT              value: unix:///csi/csi.sock
复制代码

deployment:liveness-prometheus 容器部署的启动参数配置

          args:            - "--type=liveness"            - "--endpoint=$(CSI_ENDPOINT)"            - "--metricsport=8680"            - "--metricspath=/metrics"            - "--polltime=60s"            - "--timeout=3s"          env:            - name: CSI_ENDPOINT              value: unix:///csi/csi-provisioner.sock
复制代码

daemonset:liveness-prometheus 容器部署的启动参数配置

          args:            - "--type=liveness"            - "--endpoint=$(CSI_ENDPOINT)"            - "--metricsport=8680"            - "--metricspath=/metrics"            - "--polltime=60s"            - "--timeout=3s"          env:            - name: CSI_ENDPOINT              value: unix:///csi/csi.sock
复制代码


下面是部分参数解析,详细参数解析请参考:


rbd:https://github.com/ceph/ceph-csi/blob/devel/docs/deploy-rbd.md


cephfs:https://github.com/ceph/ceph-csi/blob/devel/docs/deploy-cephfs.md


nodeid


node 的唯一标识,一般填 node ip 或 node name。


type


driver 类型,可选项有 rbd/cephfs/liveness,对应 rbdType/cephfsType/livenessType 三个类型的服务。


controllerserver


为 true 时,启动 ControllerServer 与 IdentityServer。


nodeserver


为 true 时,启动 NodeServer 与 IdentityServer。


endpoint


ceph-csi 组件暴露的 grpc 服务 socket 地址,external-provisioner 组件将与该 socket 地址通信,发出创建、删除存储的请求。默认值为unix://tmp/csi.sock


v


日志输出等级。


drivername


driver 名称,与storageclass对象里的provisioner属性值保持一致,默认值为rbd.csi.ceph.com。根据指定 driver 名称来决定由哪个 driver 来负责存储的相关操作。


pidlimit


在 cgroups 中配置 PID 限制,限制在大量创建、删除存储操作时导致产生大量的 PID。-1 代表配置限制为最大值,0 代表不限制,默认值为0


enablegrpcmetrics


[DEPRECATED]设置为true时,开启 grpc metrics。默认值为false


metricsport


liveness/grpc metrics 暴露端口。默认值8080


metricspath


liveness/grpc metrics 暴露 url。默认值/metrics


polltime


存活探测(probe 请求)的时间间隔。


timeout


存活探测(probe 请求)超时时间。

发布于: 2021 年 04 月 24 日阅读数: 21
用户头像

良凯尔

关注

热爱的力量 2020.01.10 加入

kubernetes开发者

评论

发布
暂无评论
ceph-csi源码分析(2)-组件启动参数分析