问题描述
我配置了将 arangoDB 的外部服务(用于监控 arangoDB 指标)添加到 Prometheus 服务监控器。我还需要配置 bearerTokenSecret
,因为它是连接到此外部 arangoDB 指标的唯一方法。但是,当我使用 terraform apply 进行部署时,我收到此错误消息:
helm_release.arangodb-servicemonitor: Creating...
╷
│ Error: release arangodb-servicemonitor Failed,and has been uninstalled due to atomic being set: Service "arangodb-servicemonitor" is invalid: spec.externalName: Invalid value: "abcd.arangodb.cloud:1234": a DNS-1123 subdomain must consist of lower case alphanumeric characters,'-' or '.',and must start and end with an alphanumeric character (e.g. 'example.com',regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
│
│ with helm_release.arangodb-servicemonitor,│ on prometheus.tf line 56,in resource "helm_release" "arangodb-servicemonitor":
│ 56: resource "helm_release" "arangodb-servicemonitor" {
│
╵
make: *** [Makefile:63: apply] Error 1
这是我关心的配置文件:
/helm/charts/arangodb-servicemonitor/templates/service_monitor.tpl
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
Metadata:
name: arangodb-servicemonitor
# Change this to the namespace the arangodb-servicemonitor instance is running in
namespace: prometheus
labels:
serviceapp: arangodb-servicemonitor
release: prometheus
spec:
selector:
matchLabels:
# Targets arangodb service
app: arangodb-servicemonitor
release: prometheus
endpoints:
# TO DO: use an array (List) of endpoints to monitor many endpoints
- port: metrics
interval: 30s
bearerTokenSecret:
name: arangoDB-monitor-token
key: token
namespaceSelector:
matchNames:
# TO DO: use an array (List) of endpoints to monitor many endpoints
- default
/helm/charts/arangodb-servicemonitor/templates/endpoints.yaml
kind: Endpoints
apiVersion: v1
Metadata:
name: arangodb-servicemonitor
labels:
app: arangodb-servicemonitor
subsets:
- addresses:
- ip: abcd.arangodb.cloud:1234
ports:
- name: metrics
port: 9000
protocol: TCP
/helm/charts/arangodb-servicemonitor/templates/service.yaml
apiVersion: v1
kind: Service
Metadata:
name: arangodb-servicemonitor
namespace: prometheus
labels:
app: arangodb-servicemonitor
release: prometheus
spec:
type: ClusterIP
externalName: abcd.arangodb.cloud:1234
ports:
- name: metrics
port: 9000
targetPort: 9000
protocol: TCP
type: ExternalName
/helm/charts/arangodb-servicemonitor/Chart.yaml
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,# software distributed under the License is distributed on an
# "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND,either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
apiVersion: v1
appVersion: "1.0.0"
description: Prometheus Service monitor
name: arangodb-servicemonitor
version: 1.0.0
/terraform/kubernetes/prometheus.tf
resource "kubernetes_namespace" "prometheus" {
Metadata {
name = "prometheus"
}
}
resource "kubernetes_config_map" "prometheus_config" {
Metadata {
name = "prometheus-config"
namespace = "prometheus"
}
data = {
"prometheus.yml" = file("${path.module}/files/prometheus_config_map.yaml")
}
depends_on = [
kubernetes_namespace.prometheus
]
}
# Values documentation: https://github.com/bitnami/charts/blob/master/bitnami/kube-prometheus/values.yaml
resource "helm_release" "prometheus" {
name = "prometheus"
repository = local.helm_repositories.bitnami
chart = "kube-prometheus"
version = "3.4.0"
namespace = "prometheus"
atomic = true
max_history = 5
values = [
file("${path.module}/helm_values/security.yaml.tpl"),file("${path.module}/helm_values/prometheus.yaml")
]
depends_on = [
kubernetes_config_map.prometheus_config
]
}
# Values documentation: https://github.com/bitnami/charts/blob/master/bitnami/kube-prometheus/values.yaml
resource "helm_release" "jobs-manager-servicemonitor" {
name = "jobs-manager-servicemonitor"
repository = local.helm_repositories.local
chart = "jobs-manager-servicemonitor"
version = "1.0.1"
namespace = "prometheus"
atomic = true
max_history = 5
depends_on = [
helm_release.prometheus
]
}
# Values documentation: https://github.com/bitnami/charts/blob/master/bitnami/kube-prometheus/values.yaml
resource "helm_release" "arangodb-servicemonitor" {
name = "arangodb-servicemonitor"
repository = local.helm_repositories.local
chart = "arangodb-servicemonitor"
version = "1.0.0"
namespace = "prometheus"
atomic = true
max_history = 5
depends_on = [
helm_release.prometheus
]
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)