使用 GitLab-Exporter chart
gitlab-exporter
子 chart 为 GitLab 应用程序特定数据提供 Prometheus 指标。其直接与 PostgreSQL 通信,执行查询检索 CI 构建、拉取镜像等的数据。此外,它使用 Sidekiq API, 该 API 与 Redis 通信,收集有关 Sidekiq 队列状态的不同指标(例如作业数量)。
要求
此 chart 依赖于 Redis 和 PostgreSQL 服务,可以作为完整 GitLab chart 的一部分,或者作为或者作为从此 chart 部署到 Kubernetes 集群访问的外部服务。
配置
gitlab-exporter
chart chart 配置如下:全局设置和chart 设置。
安装命令行选项
下表包含可以使用 --set
标志提供给 helm install
命令的所有可能的 chart 配置。
参数 | 默认值 | 说明 |
---|---|---|
annotations |
Pod annotations | |
common.labels |
{} |
应用于此 chart 创建的所有对象的补充标签。 |
podLabels |
补充 Pod 标签。 不会用于选择器。 | |
common.labels |
应用于此 chart 创建的所有对象的补充标签。 | |
deployment.strategy |
{} |
允许配置 deployment 使用的更新策略。如果未提供,使用集群默认值。 |
enabled |
true |
GitLab Exporter 启用标志 |
extraContainers |
包含的附加容器列表 | |
extraInitContainers |
包含的 init containers 列表 | |
extraVolumeMounts |
要添加的附加挂载卷列表 | |
extraVolumes |
要创建的附加卷列表 | |
extraEnv |
要暴露的附加环境变量列表 | |
extraEnvFrom |
要暴露的其它数据源的额外环境变量列表 | |
image.pullPolicy |
IfNotPresent |
GitLab 镜像拉取策略 |
image.pullSecrets |
用于镜像仓库的 Secrets | |
image.repository |
registry.jihulab.com/gitlab-cn/build/cng-images/gitlab-exporter |
GitLab Exporter 镜像仓库 |
image.tag |
镜像标签 | |
init.image.repository |
initContainer 镜像 | |
init.image.tag |
initContainer 镜像标签 | |
init.containerSecurityContext |
initContainer 容器特定 securityContext | |
metrics.enabled |
true |
切换 Prometheus metrics exporter |
metrics.port |
9168 |
Prometheus metrics exporter 的监听端口 |
metrics.path |
/metrics |
指标端点路径 |
metrics.serviceMonitor.enabled |
false |
是否创建 ServiceMonitor 使 Prometheus Operator 能够管理指标抓取,请注意启用此功能会删除 prometheus.io 抓取注释 |
metrics.serviceMonitor.additionalLabels |
{} |
要添加到 ServiceMonitor 的其它标签 |
metrics.serviceMonitor.endpointConfig |
{} |
ServiceMonitor 的附加端点配置 |
metrics.annotations |
已废弃 设置明确的指标注释。替换为模板内容。 | |
priorityClassName |
指派给 Pod 的 Priority class。 | |
resources.requests.cpu |
75m |
极狐GitLab Exporter 最小 CPU |
resources.requests.memory |
100M |
极狐GitLab Exporter 最小内存 |
serviceLabels |
{} |
补充 service 标签 |
service.externalPort |
9168 |
极狐GitLab Exporter 对外暴露的端口 |
service.internalPort |
9168 |
极狐GitLab Exporter 内部端口 |
service.name |
gitlab-exporter |
极狐GitLab Exporter service 名称 |
service.type |
ClusterIP |
极狐GitLab Exporter service 类型 |
securityContext.fsGroup |
1000 |
在其下启动 Pod 的 Group ID |
securityContext.runAsUser |
1000 |
在其下启动 Pod 的 User ID |
securityContext.fsGroupChangePolicy |
更改卷的所有权和权限的策略(需要 Kubernetes 1.23) | |
containerSecurityContext |
覆盖启动容器的容器 securityContext | |
containerSecurityContext.runAsUser |
1000 |
允许覆盖启动容器的特定 securityContext |
tolerations |
[] |
分配给 Pod 的容忍标签 |
psql.port |
设置 PostgreSQL 服务器端口。优先于 global.psql.port
|
|
tls.enabled |
false |
启用极狐GitLab Exporter TLS |
tls.secretName |
{Release.Name}-gitlab-exporter-tls |
极狐GitLab Exporter TLS secret。必需指向 Kubernetes TLS secret |
Chart 配置示例
extraEnv
extraEnv
允许您在 Pod 的所有容器中暴露额外的环境变量。
extraEnv
示例如下:
extraEnv:
SOME_KEY: some_value
SOME_OTHER_KEY: some_other_value
当容器启动时,您可以确认环境变量是否暴露:
env | grep SOME
SOME_KEY=some_value
SOME_OTHER_KEY=some_other_value
extraEnvFrom
extraEnvFrom
允许您从 pod 中的所有容器中的其它数据源,暴露其它环境变量。
下面是一个使用 extraEnvFrom
的示例:
extraEnvFrom:
MY_NODE_NAME:
fieldRef:
fieldPath: spec.nodeName
MY_CPU_REQUEST:
resourceFieldRef:
containerName: test-container
resource: requests.cpu
SECRET_THING:
secretKeyRef:
name: special-secret
key: special_token
# optional: boolean
CONFIG_STRING:
configMapKeyRef:
name: useful-config
key: some-string
# optional: boolean
image.pullSecrets
pullSecrets
允许您通过私有从仓库的认证,并从中为 Pod 拉取镜像。
有关私有 registry 及其身份验证方法的详细信息,参考Kubernetes 文档。
pullSecrets
示例如下:
image:
repository: my.image.repository
pullPolicy: Always
pullSecrets:
- name: my-secret-name
- name: my-secondary-secret-name
annotations
annotations
允许您向 GitLab Exporter pods 添加 annotation。例如:
annotations:
kubernetes.io/example-annotation: annotation-value
全局设置
我们在 chart 之间共享一些通用的全局设置。有关详细信息,请参见 Globals 文档。
Chart 设置
以下值用于配置 GitLab Exporter pod。
metrics.enabled
默认情况下,pod 暴露一个在 /metrics
暴露一个 metrics 端点。当启用 metrics 时,向每个 pod 添加 annotation,使得 Prometheus 服务器可以发现并抓取暴露的 metrics。