我当前正在尝试将Prometheus适配器安装到AWS EKS Kubernetes群集中。但是,Prometheus适配器的关联APIService在连接到Prometheus适配器时遇到问题,并且其状态未更改为"可用"
当我运行kubectl edit apiservice custom.metrics.k8s.io
时,我会得到以下信息和相应的错误消息:
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
annotations:
meta.helm.sh/release-name: adapter-test
meta.helm.sh/release-namespace: monitoring
creationTimestamp: "2022-11-29T11:00:36Z"
labels:
app.kubernetes.io/component: metrics
app.kubernetes.io/instance: adapter-test
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: prometheus-adapter
app.kubernetes.io/part-of: prometheus-adapter
app.kubernetes.io/version: v0.10.0
helm.sh/chart: prometheus-adapter-3.4.2
name: v1beta1.custom.metrics.k8s.io
resourceVersion: "644865077"
uid: 50e1d07b-5db8-49b0-92d3-af1ec581a096
spec:
group: custom.metrics.k8s.io
groupPriorityMinimum: 100
insecureSkipTLSVerify: true
service:
name: adapter-test-prometheus-adapter
namespace: monitoring
port: 443
version: v1beta1
versionPriority: 100
status:
conditions:
- lastTransitionTime: "2022-11-29T11:00:36Z"
message: 'failing or missing response from https://192.168.2.20:6443/apis/custom.metrics.k8s.io/v1beta1:
Get "https://192.168.2.20:6443/apis/custom.metrics.k8s.io/v1beta1": Address
is not allowed'
reason: FailedDiscoveryCheck
status: "False"
type: Available
版本:
Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.4", GitCommit:"872a965c6c6526caa949f0c6ac028ef7aff3fb78", GitTreeState:"clean", BuildDate:"2022-11-09T13:36:36Z", GoVersion:"go1.19.3", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"22+", GitVersion:"v1.22.15-eks-fb459a0", GitCommit:"be82fa628e60d024275efaa239bfe53a9119c2d9", GitTreeState:"clean", BuildDate:"2022-10-24T20:33:23Z", GoVersion:"go1.16.15", Compiler:"gc", Platform:"linux/amd64"}
另一方面,我可以使用curl命令从带有kubectl的PC访问服务"www.example.com",而不会出现任何问题:https://192.168.2.20:6443/apis/custom.metrics.k8s.io/v1beta1" from a PC with kubectl without any problems: I get for the commandcurl -k --header "Authorization: Bearer <<MYTOKEN>>" "https://172.20.44.186:443/apis/custom.metrics.k8s.io/v1beta1"
答案是:
{
"kind": "APIResourceList",
"apiVersion": "v1",
"groupVersion": "custom.metrics.k8s.io/v1beta1",
"resources": [
{
"name": "namespaces/container_threads",
"singularName": "",
"namespaced": false,
"kind": "MetricValueList",
"verbs": [
"get"
]
},
{
"name": "pods/container_threads",
"singularName": "",
"namespaced": true,
"kind": "MetricValueList",
"verbs": [
"get"
]
}
]
}
但是在适配器的日志中,我找不到任何关于API服务请求的条目,我该如何进一步分析错误并消 debugging 误呢?
1条答案
按热度按时间fhity93d1#
您是否正在运行自定义CNI(印花布、编织布等)?
参见:www.example.comhttps://github.com/kubernetes-sigs/prometheus-adapter/issues/268#issuecomment-729480071
tldr;您不妨确保:
hostNetwork.enabled: true
dnsPolicy=ClusterFirstWithHostNet