Skip to content

Latest commit

 

History

History
112 lines (84 loc) · 4.31 KB

README.md

File metadata and controls

112 lines (84 loc) · 4.31 KB

通过Helm部署CMDB

要求

准备 bk-cmdb 镜像

  • 方式一:使用docker build构建镜像, 详情请参考制作docker镜像
  • 方式二:从docker hub下载 docker pull ccr.ccs.tencentyun.com/bk.io/cmdb-standalone:latest

制作 chart

创建一个空白的chart
# helm create bk-cmdb

修改对应的文件
# vim values.yaml

image:
  repository: ccr.ccs.tencentyun.com/bk.io/cmdb-standalone  (镜像仓库地址)
  pullPolicy: IfNotPresent
  # Overrides the image tag whose default is the chart appVersion.
  tag: ""


service:
  type: NodePort   <- 修改
  port: 8090  (对应cmdb_webserver端口) 


# vim Chart.yaml
appVersion: "latest"  <- (镜像版本)

打包使用

对格式进行检查
# helm lint bk-cmdb

打包
# helm package bk-cmdb

安装chart
# helm install bk-cmdb-chart bk-cmdb-0.1.0.tgz

检查服务是否正常启动

# kubectl get pods
NAME                                     READY   STATUS    RESTARTS   AGE
bk-cmdb-chart-7c985f78bd-xvkb7           1/1     Running   0          13h

进入容器启动服务

进入容器
# docker exec -it 容器id /bin/bash

[root@bk-cmdb-chart-7c985f78bd-xvkb7 cmdb]# pwd
/data/cmdb

启动服务
[root@bk-cmdb-chart-7c985f78bd-xvkb7 cmdb]# ./start.sh
starting: cmdb_adminserver
starting: cmdb_apiserver
starting: cmdb_authserver
starting: cmdb_cloudserver
starting: cmdb_coreservice
starting: cmdb_datacollection
starting: cmdb_eventserver
starting: cmdb_hostserver
starting: cmdb_operationserver
starting: cmdb_procserver
starting: cmdb_taskserver
starting: cmdb_toposerver
starting: cmdb_webserver
root       8809      0  0 02:28 ?        00:00:31 ./cmdb_adminserver --addrport=127.0.0.1:60004 --logtostderr=false --log-dir=./logs --v=3 
--config=configures/migrate.yaml
root       8826      0  0 02:28 ?        00:00:35 ./cmdb_apiserver --addrport=127.0.0.1:8080 --logtostderr=false --log-dir=./logs --v=3 --regdiscv=127.0.0.1:2181 --enable-auth=false
root       8874      0  0 02:28 ?        00:00:41 ./cmdb_cloudserver --addrport=127.0.0.1:60013 --logtostderr=false --log-dir=./logs --v=3 --regdiscv=127.0.0.1:2181 --enable-auth=false --enable_cryptor=false
root       8893      0  1 02:28 ?        00:01:02 ./cmdb_coreservice --addrport=127.0.0.1:50009 --logtostderr=false --log-dir=./logs --v=3 --regdiscv=127.0.0.1:2181
root       9123      0  0 02:28 ?        00:00:35 ./cmdb_datacollection --addrport=127.0.0.1:60005 --logtostderr=false --log-dir=./logs --v=3 --regdiscv=127.0.0.1:2181 --enable-auth=false
root       9539      0  1 02:28 ?        00:01:06 ./cmdb_eventserver --addrport=127.0.0.1:60009 --logtostderr=false --log-dir=./logs --v=3 --regdiscv=127.0.0.1:2181 --enable-auth=false
root       9775      0  0 02:28 ?        00:00:34 ./cmdb_hostserver --addrport=127.0.0.1:60001 --logtostderr=false --log-dir=./logs --v=3 --regdiscv=127.0.0.1:2181 --enable-auth=false
root      10073      0  0 02:28 ?        00:00:31 ./cmdb_operationserver --addrport=127.0.0.1:60011 --logtostderr=false --log-dir=./logs --v=3 --regdiscv=127.0.0.1:2181 --enable-auth=false
root      10094      0  0 02:28 ?        00:00:30 ./cmdb_procserver --addrport=127.0.0.1:60003 --logtostderr=false --log-dir=./logs --v=3 --regdiscv=127.0.0.1:2181 --enable-auth=false
root      10116      0  0 02:28 ?        00:00:38 ./cmdb_taskserver --addrport=127.0.0.1:60012 --logtostderr=false --log-dir=./logs --v=3 --regdiscv=127.0.0.1:2181
root      10140      0  0 02:28 ?        00:00:31 ./cmdb_toposerver --addrport=127.0.0.1:60002 --logtostderr=false --log-dir=./logs --v=3 --regdiscv=127.0.0.1:2181 --enable-auth=false
root      10159      0  0 02:28 ?        00:00:26 ./cmdb_webserver --addrport=127.0.0.1:80 --logtostderr=false --log-dir=./logs --v=3 --regdiscv=127.0.0.1:2181
process count should be: 12 , now: 12
Not Running: cmdb_authserver

导出服务并访问CMDB

# kubectl get svc
NAME                    TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
bk-cmdb-chart           NodePort    127.0.0.2     <none>        8090:31664/TCP                 13h

运行效果

k8s 中运行效果