使用极狐GitLab-Exporter chart
- Tier: 基础版,专业版,旗舰版
- Offering: 私有化部署
gitlab-exporter 子 chart 提供了极狐GitLab 应用程序特定数据的 Prometheus 指标。它直接与 PostgreSQL 交互以执行查询,从而检索 CI 构建、拉取镜像等数据。此外,它使用 Sidekiq API,后者与 Redis 交互以收集有关 Sidekiq 队列状态的不同指标(例如,作业数量)。
要求
此 chart 依赖于 Redis 和 PostgreSQL 服务,这些服务可以是完整极狐GitLab chart 的一部分,也可以是 Kubernetes 集群上可以访问的外部服务。
配置
gitlab-exporter chart 配置如下:全局设置 和 Chart 设置。
安装命令行选项
下表包含了所有可以通过 --set 标志提供给 helm install 命令的 chart 配置。
参数 | 默认值 | 描述 |
---|---|---|
affinity | {} | 亲和性规则 用于 pod 分配 |
annotations | Pod 注释 | |
common.labels | {} | 应用于此 chart 创建的所有对象的补充标签 |
podLabels | 补充 Pod 标签。不会用于选择器。 | |
common.labels | 应用于此 chart 创建的所有对象的补充标签 | |
deployment.strategy | {} | 允许配置部署所使用的更新策略 |
enabled | true | 极狐GitLab 导出器启用标志 |
extraContainers | 包含要包含的容器列表的多行文字样式字符串 | |
extraInitContainers | 要包含的额外 init 容器列表 | |
extraVolumeMounts | 要挂载的额外卷列表 | |
extraVolumes | 要创建的额外卷列表 | |
extraEnv | 要暴露的额外环境变量列表 | |
extraEnvFrom | 要从其他数据源暴露的额外环境变量列表 | |
image.pullPolicy | IfNotPresent | 极狐GitLab 镜像拉取策略 |
image.pullSecrets | 镜像仓库的密钥 | |
image.repository | registry.gitlab.com/gitlab-org/build/cng/gitlab-exporter | 极狐GitLab 导出器镜像仓库 |
image.tag | 镜像标签 | |
init.image.repository | initContainer 镜像 | |
init.image.tag | initContainer 镜像标签 | |
init.containerSecurityContext | initContainer 特定 安全上下文 | |
init.containerSecurityContext.allowPrivilegeEscalation | false | initContainer 特定:控制进程是否可以获得比其父进程更多的权限 |
init.containerSecurityContext.runAsNonRoot | true | initContainer 特定:控制容器是否以非 root 用户身份运行 |
init.containerSecurityContext.capabilities.drop | [ "ALL" ] | initContainer 特定:删除容器的 Linux 能力 |
metrics.enabled | true | 是否应提供指标端点以供抓取 |
metrics.port | 9168 | 指标端口 |
metrics.path | /metrics | 指标路径 |
metrics.serviceMonitor.enabled | false | 是否应该创建一个 ServiceMonitor 以允许 Prometheus Operator 管理指标抓取,注意启用此选项将移除 prometheus.io 抓取注释 |
metrics.serviceMonitor.additionalLabels | {} | 要添加到 ServiceMonitor 的其他标签 |
metrics.serviceMonitor.endpointConfig | {} | ServiceMonitor 的其他端点配置 |
metrics.annotations | 已弃用 设置显式指标注释。已被模板内容替代。 | |
priorityClassName | 分配给 pod 的 优先级类 | |
resources.requests.cpu | 75m | 极狐GitLab 导出器最小 CPU |
resources.requests.memory | 100M | 极狐GitLab 导出器最小内存 |
serviceLabels | {} | 补充服务标签 |
service.externalPort | 9168 | 极狐GitLab 导出器公开端口 |
service.internalPort | 9168 | 极狐GitLab 导出器内部端口 |
service.name | gitlab-exporter | 极狐GitLab 导出器服务名称 |
service.type | ClusterIP | 极狐GitLab 导出器服务类型 |
serviceAccount.annotations | {} | ServiceAccount 注释 |
serviceAccount.automountServiceAccountToken | false | 指示是否应在 pod 中挂载默认 ServiceAccount 访问令牌 |
serviceAccount.create | false | 指示是否应该创建一个 ServiceAccount |
serviceAccount.enabled | false | 指示是否使用 ServiceAccount |
serviceAccount.name | ServiceAccount 的名称。如果未设置,则使用完整 chart 名称 | |
securityContext.fsGroup | 1000 | 应以其启动的 pod 的组 ID |
securityContext.runAsUser | 1000 | 应以其启动的 pod 的用户 ID |
securityContext.fsGroupChangePolicy | 改变卷的所有权和权限的策略(需要 Kubernetes 1.23) | |
securityContext.seccompProfile.type | RuntimeDefault | 使用的 Seccomp 配置文件 |
containerSecurityContext | 覆盖容器的 安全上下文 | |
containerSecurityContext.runAsUser | 1000 | 允许覆盖容器启动时的特定安全上下文用户 ID |
containerSecurityContext.allowPrivilegeEscalation | false | 控制容器的进程是否可以获得比其父进程更多的权限 |
containerSecurityContext.runAsNonRoot | false | 控制容器是否以非 root 用户身份运行 |
containerSecurityContext.capabilities.drop | [ "ALL" ] | 删除 Gitaly 容器的 Linux 能力 |
tolerations | [] | pod 分配的容忍标签 |
psql.port | 设置 PostgreSQL 服务器端口。优先于 global.psql.port | |
tls.enabled | false | 极狐GitLab 导出器 TLS 启用 |
tls.secretName | {Release.Name}-gitlab-exporter-tls | 极狐GitLab 导出器 TLS 密钥。必须指向一个 Kubernetes TLS 密钥。 |
Chart 配置示例
extraEnv
extraEnv 允许您在 pod 中的所有容器中暴露额外的环境变量。
以下是 extraEnv 的示例用法:
yamlextraEnv: SOME_KEY: some_value SOME_OTHER_KEY: some_other_value
启动容器时,您可以确认环境变量是否已暴露:
shellenv | grep SOME SOME_KEY=some_value SOME_OTHER_KEY=some_other_value
extraEnvFrom
extraEnvFrom 允许您从其他数据源中在 pod 中的所有容器中暴露额外的环境变量。
以下是 extraEnvFrom 的示例用法:
yaml1extraEnvFrom: 2 MY_NODE_NAME: 3 fieldRef: 4 fieldPath: spec.nodeName 5 MY_CPU_REQUEST: 6 resourceFieldRef: 7 containerName: test-container 8 resource: requests.cpu 9 SECRET_THING: 10 secretKeyRef: 11 name: special-secret 12 key: special_token 13 # optional: boolean 14 CONFIG_STRING: 15 configMapKeyRef: 16 name: useful-config 17 key: some-string 18 # optional: boolean
image.pullSecrets
pullSecrets 允许您进行身份验证以从私人注册表中拉取 pod 的镜像。
有关私人注册表及其身份验证方法的更多详细信息,请参见 Kubernetes 文档。
以下是 pullSecrets 的示例用法:
YAML1image: 2 repository: my.image.repository 3 pullPolicy: Always 4 pullSecrets: 5 - name: my-secret-name 6 - name: my-secondary-secret-name
serviceAccount
此部分控制是否应创建一个 ServiceAccount 以及是否应在 pod 中挂载默认访问令牌。
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
annotations | Map | {} | ServiceAccount 注释。 |
automountServiceAccountToken | Boolean | false | 控制是否应在 pod 中挂载默认 ServiceAccount 访问令牌。除非某些 sidecar 需要,否则不应启用此选项(例如,Istio)。 |
create | Boolean | false | 指示是否应创建 ServiceAccount。 |
enabled | Boolean | false | 指示是否使用 ServiceAccount。 |
name | String | ServiceAccount 名称。如果未设置,则使用完整 chart 名称。 |
affinity
有关更多信息,请参阅 affinity。
annotations
annotations 允许您向极狐GitLab 导出器 pod 添加注释。例如:
YAMLannotations: kubernetes.io/example-annotation: annotation-value
全局设置
我们在 chart 之间共享一些常见的全局设置。有关常见配置选项的详细信息,请参阅 全局文档,例如极狐GitLab 和注册表主机名。
Chart 设置
以下值用于配置极狐GitLab 导出器 pod。
metrics.enabled
默认情况下,pod 在 /metrics 处公开一个指标端点。当启用指标时,会将注释添加到每个 pod,以允许 Prometheus 服务器发现和抓取公开的指标。