问题描述
请记住,我是Kubernetes的新手。
我正在尝试将现有的K8集群集成到GitLab中。我已经将集群添加到gitlab中,并且可以看到已提取项目。但是,在“运行状况”选项卡下,我看到我需要安装Prometheus。
在集群上,这是我得到的错误
[user]$ kubectl describe pvc prometheus-prometheus-server -ngitlab-managed-apps
Name: prometheus-prometheus-server
Namespace: gitlab-managed-apps
StorageClass:
Status: Pending
Volume:
Labels: app=prometheus
chart=prometheus-9.5.2
component=server
heritage=Tiller
release=prometheus
Annotations: <none>
Finalizers: [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode: Filesystem
Mounted By: prometheus-prometheus-server-78bdf8f5b7-dkctg
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
normal FailedBinding 6s (x2 over 6s) persistentvolume-controller no persistent volumes available for this claim and no storage class is set
我都尝试了这两种方法,指定了存储类并添加了永久卷,但没有结果,错误仍然相同。我不明白为什么没有要求该数量。
这就是添加的音量的样子
[user]$ kubectl get pv
NAME CAPACITY ACCESS MODES RECLaim POLICY STATUS CLaim STORAGECLASS REASON AGE
prometheus-prometheus-server 2Gi RWX Retain Available manual 17m
kubectl describe pv prometheus-prometheus-server
Name: prometheus-prometheus-server
Labels: app=prometheus
chart=prometheus-9.5.2
component=server
heritage=Tiller
release=prometheus
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"PersistentVolume","Metadata":{"annotations":{},"labels":{"app":"prometheus","chart":"prometheus-9.5.2","compone...
Finalizers: [kubernetes.io/pv-protection]
StorageClass: manual
Status: Available
Claim:
Reclaim Policy: Retain
Access Modes: RWX
VolumeMode: Filesystem
Capacity: 2Gi
Node Affinity: <none>
Message:
Source:
Type: HostPath (bare host directory volume)
Path: /var/prometheus-server
HostPathType:
Events: <none>
解决方法
我不确定在哪里可以找到GitLab管理的Prometheus的确切PVC定义,但是我确定PVC希望声明容量至少为8Gi且访问模式为RWO
的PV。 。您需要创建一个满足此条件的持久性卷(当前提供2Gi和RWX)。
据我所知,带有RWO的PVC并未分配给RWX PV。
,不再需要将 Prometheus 部署到 gitlab-managed-apps
(由来自 other answer 的线程引用)。
自 GitLab 13.11(2021 年 4 月)以来没有,其中包括:
自带 Prometheus 以获得最佳的 GitLab - Kubernetes 集成体验
通过将集群服务与 GitLab 集成,您可以受益于各种 GitLab 功能,例如 Environment boards、Prometheus metrics 和 application logs。以前,这些功能要求您使用 GitLab 托管应用程序,这不适合我们许多用户的工作流程和要求。
在此版本中,您可以通过 GitLab 服务与 Prometheus 和 Kubernetes 集成,并按照您自己的公司流程和政策自行维护。如果您刚开始使用,我们会提供大量文档和推荐的有关如何安装这些应用程序的工作流程。您仍然可以像使用 GitLab Managed Prometheus 一样保留 GitLab 中可用的深度指标集成。
参见 Documentation 和 Issue。