ConfigMap
- ConfigMap是Kubernetes用来存储配置文件的资源对象,通过ConfigMap可以将外部配置在启动容器之前挂载到容器中的指定位置,并以此为容器中运行的程序提供配置信息;
- 重构之后管理系统中,所有HBase的组件配置都存放至ConfigMap之中,系统管理人员会根据需-要预先生成若干HBase的配置模板存放到K8S系统的ConfigMap中;
- 在业务方提供出HBase服务申请时,管理人员通过业务资源的需求结合配置模板,为申请的HBase集群组件渲染具体的hbase-site。xml以及hbase-env。sh等HBase配置相关的文件再存放到ConfigMap中;
- 最后在容器启动时,k8s会根据deployment将ConfigMap中的配置文件Mount到配置中指定的路径中;
- 和Deployment的操作类似,每一份ConfigMap也都会标记上标签,将相关的ConfigMap和对应的集群和应用关联上。

ConfigMap存档
2、组件参数配置
在引入了ConfigMap功能之后,之前创建集群的请求信息也随之改变。
- RequestData
- {
- "name": "performance-test-rmwl",
- "namespace": "online",
- "app": "kubas",
- "config_template": "online-example-base.v1",
- "status": "Ready",
- "properties": {
- "hbase.regionserver.codecs": "snappy",
- "hbase.rootdir": "hdfs://zhihu-example-online:8020/user/online-tsn/performance-test-rmwl",
- "hbase.zookeeper.property.clientPort": "2181",
- "hbase.zookeeper.quorum": "zookeeper01,zookeeper02,zookeeper03",
- "zookeeper.znode.parent": "/performance-test-rmwl"
- },
- "client_type": "java",
- "cluster_uid": "k8s-example-hbase---performance-test-rmwl---example"
- }
其中config_template指定了该集群使用的配置信息模板,之后所有和该HBase集群有关的组件配置都由该配置模板渲染出具体配置。
config_template中还预先约定了HBase组件的基础运行配置信息,如组件类型,使用的启动命令,采用的镜像文件,初始的副本数等。
- servers:
- {
- "master": {
- "servertype": "master",
- "command": "service hbase-master start && tail -f /var/log/hbase/hbase-hbase-master.log",
- "replicas": 1,
- "image": "dockerimage.zhihu.example/apps/example-master:v1.1",
- "requests": {
- "cpu": "500m",
- "memory": "5Gi"
- },
- "limits": {
- "cpu": "4000m"
- }
- },
- }
(编辑:威海站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|