Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kube-prometheus-stack] Frequent errors for alert rule KubeAggregatedAPIErrors (aggregator_unavailable_apiservice_total) #3539

Open
johnswarbrick-napier opened this issue Jun 30, 2023 · 15 comments
Labels
bug Something isn't working

Comments

@johnswarbrick-napier
Copy link
Contributor

Describe the bug a clear and concise description of what the bug is.

Hi -

Running the latest kube-prometheus-stack 47.0.0 on Azure AKS I'm getting frequent alerts for bundled rule KubeAggregatedAPIErrors:

image

It's firing regularly across >100 Azure AKS clusters, but I don't know if this is a true error or a false positive.

What does this alert mean, and do I need to tune or even disable it?

Thanks in advance! :)

What's your helm version?

version.BuildInfo{Version:"v3.12.1", GitCommit:"f32a527a060157990e2aa86bf45010dfb3cc8b8d", GitTreeState:"clean", GoVersion:"go1.20.4"}

What's your kubectl version?

Client Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.2", GitCommit:"7f6f68fdabc4df88cfea2dcf9a19b2b830f1e647", GitTreeState:"clean", BuildDate:"2023-05-17T14:20:07Z", GoVersion:"go1.20.4", Compiler:"gc", Platform:"linux/amd64"}

Which chart?

kube-prometheus-stack

What's the chart version?

47.0.0

What happened?

No response

What you expected to happen?

No response

How to reproduce it?

No response

Enter the changed values of values.yaml?

No response

Enter the command that you execute and failing/misfunctioning.

sum by (name, namespace, cluster) (increase(aggregator_unavailable_apiservice_total[10m])) > 4

Anything else we need to know?

No response

@johnswarbrick-napier johnswarbrick-napier added the bug Something isn't working label Jun 30, 2023
@zeritti zeritti changed the title [prometheus-kube-stack] Frequent errors for alert rule KubeAggregatedAPIErrors (aggregator_unavailable_apiservice_total) [kube-prometheus-stack] Frequent errors for alert rule KubeAggregatedAPIErrors (aggregator_unavailable_apiservice_total) Jul 3, 2023
@kladiv
Copy link

kladiv commented Jul 18, 2023

+1
The same here on k3s installed on Hetzner bare-metal servers

@PhilipNO
Copy link

Any feedback on this issue

@Vandersteen
Copy link

Vandersteen commented Sep 11, 2023

Also interested in more info about this.

So far we've had the following:

  • The metric-server was often crashlooping, so we gave it more resources (azure support gave us some instructions on how to do so: here)
  • The crashlooping stopped, however this error is still triggering 'often'
    • (We only messed with the memory portion of the metric server)
  • After some investigation, it seems the metric-server is sometimes being 'cpu throttled', this appears to correlate with the timings of these alerts

image

We are going to increase the cpu configs for the metric server and see if this 'helps'.

In the metric server logs we can't see anything 'strange' except a whole bunch of:

E0909 01:06:44.237015       1 nanny_lib.go:130] Get "https://xxx.hcp.westeurope.azmk8s.io:443/api/v1/nodes?resourceVersion=0": net/http: TLS handshake timeout

However these do not 'correlate' with the cpu thottling / timing of the alerts

@johnswarbrick-napier
Copy link
Contributor Author

We found a correlation between the KubeAggregatedAPIErrors alerts and what appear to be huge spikes in requests to the Kubernetes API:

image

However we have not been able to identify the source of these huge spikes, and they only seem to appear on Azure AKS.

We raised a ticket with Microsoft support, but after some initial analysis they went very quiet and we haven't made any further progress.

@chencivalue
Copy link

the same here

@johnswarbrick-napier
Copy link
Contributor Author

@chencivalue - are you running Strimzi Kafka in your AKS cluster?

@chencivalue
Copy link

@johnswarbrick-napier no but im using kafka-18.3.1 helm chart

@Vandersteen
Copy link

Might be related:

Azure/AKS#3685

@elghazal-a
Copy link

We have same thing in GKS 1.26

@damienvergnaud
Copy link

Hi, i'm experiencing the same issue on AKS with K8S v1.29.2.

I see that your thoughts are directed to metric-server too, so i'll communicate my observations.

Metric server is using the aggregated API layer of Kubernetes.

  • For this, an AKS basic installation seems to declare a PATH of the Kubernetes API (Using an ApiService Object) for k8s API-Server to forward the path directly to the extended API server of metric server.
    • In my case, the metric-server ApiService Object is the only one NOT using "Local" as a service in opposite to all others.
    • Maybe it's your case too ?
    • This COULD justify real latency beetween api server and metric server but i'm failing trying to prove it actually.

K8S documentation about aggregated layer strongly advise to observe less than 5s of latency beetween API Server and extended API Server.
https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/#response-latency

This issue could be opened or mentionned elsewhere as the prometheus alert from the runbook (KubeAggregatedAPIErrors) seems legit.

In my case, the APIService events send a failDiscoveryCheck on v1.beta.metrics.k8s.io/

@jfouche-vendavo
Copy link

jfouche-vendavo commented Aug 6, 2024

We noticed a strong correlation in this issue with KEDA certs rotation. (We are running KEDA on AKS)
Unfortunately, fixing the certs rotation issue did not stop the KubeAggregatedAPIErrors !

@jfouche-vendavo
Copy link

UPDATE:
FYI I have disabled cert rotation on Keda as above but this does not fix the KubeAggregatedAPIErrors. These errors must be happening elsewhere (possibly not on KEDA).

@damienvergnaud
Copy link

We actually removed this alert of prometheus (KubeAggregatedAPIDown) from what we are alerted on, as per Microsoft response after a 1 year troubleshooting on the causes, hope it helps someone out there.

Summary/Resolution/Findings:

After reviewing similar cases in our history and all the tickets escalated to the Product Group, we have identified a single root cause analysis (RCA):

The alerts always coincide with the restarts of the API server pods, and for your cluster, this is indeed the case. This alert/error is inevitable because it is due to the destruction/creation (considering the container startup) of the API server pods, knowing that there are several replicas that coexist at all times to maintain a 100% SLA. According to your cluster metrics, the SLA has always been maintained at 100%. Conclusion: This Prometheus alert is unnecessary in a PaaS service like AKS because the control plane is completely managed on our side, and the API availability is automatically guaranteed, except in the case of a regional/global outage.

PS: The alerts coincide with the restarts, but this does not mean they are triggered at every restart. Restarts can occur several times a day.

Should you require any further assistance or have any questions regarding this matter, please do not hesitate to reach out. We are committed to providing you with the highest level of support and are here to help with any additional needs you may have.

Thank you for choosing Microsoft…!!

@damienvergnaud
Copy link

damienvergnaud commented Nov 25, 2024

We actually removed this alert of prometheus (KubeAggregatedAPIErrors) from what we are alerted on, as per Microsoft response after a 1 year troubleshooting on the causes, hope it helps someone out there.

Summary/Resolution/Findings:

After reviewing similar cases in our history and all the tickets escalated to the Product Group, we have identified a single root cause analysis (RCA):

The alerts always coincide with the restarts of the API server pods, and for your cluster, this is indeed the case. This alert/error is inevitable because it is due to the destruction/creation (considering the container startup) of the API server pods, knowing that there are several replicas that coexist at all times to maintain a 100% SLA. According to your cluster metrics, the SLA has always been maintained at 100%. Conclusion: This Prometheus alert is unnecessary in a PaaS service like AKS because the control plane is completely managed on our side, and the API availability is automatically guaranteed, except in the case of a regional/global outage.

PS: The alerts coincide with the restarts, but this does not mean they are triggered at every restart. Restarts can occur several times a day.

Should you require any further assistance or have any questions regarding this matter, please do not hesitate to reach out. We are committed to providing you with the highest level of support and are here to help with any additional needs you may have.

Thank you for choosing Microsoft…!!

This proposal has been made during my working time at WeScale company ;)

@sebastiangaiser
Copy link
Contributor

sebastiangaiser commented Nov 27, 2024

I think the root cause is a not correct alert addressed in kubernetes-monitoring/kubernetes-mixin#774

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants