Azure / AKS

Azure Kubernetes Service
https://azure.github.io/AKS/
1.95k stars 304 forks source link

[Question] How to remove AKS's metrics-server #4436

Open asparagusbeef opened 1 month ago

asparagusbeef commented 1 month ago
          Just disable prometheus-adapter and use metrics-server instead. They serve the same purpose, since AKS already provides metrics-server by default, don't use prometheus adapter.

Originally posted by @rouke-broersma in https://github.com/Azure/AKS/issues/3631#issuecomment-1529498389


I don't think that's the correct response, because there are other use cases for disabling the metrics-server. Perhpas for the specific premetheous use-case it doesn't make sense, but for example, for use with KEDA, according to the Docs "Only one metric server is allowed in the Kubernetes cluster. Because of that the KEDA add-on should be the only metrics server inside the cluster."

And I do see HPA misbehaving, and then goes back to normal for a minute when I delete metrics-server, then starts misbehaving again the moment the metric-server starts.

I tried running this

kubectl delete service/metrics-server -n  kube-system
kubectl delete deployment.apps/metrics-server  -n  kube-system
kubectl delete apiservices.apiregistration.k8s.io v1beta1.metrics.k8s.io
kubectl delete clusterroles.rbac.authorization.k8s.io system:aggregated-metrics-reader
kubectl delete clusterroles.rbac.authorization.k8s.io system:metrics-server 
kubectl delete clusterrolebinding metrics-server:system:auth-delegator
kubectl delete clusterrolebinding system:metrics-server          
kubectl delete rolebinding metrics-server-auth-reader -n kube-system 
kubectl delete serviceaccount metrics-server -n kube-system

From here https://github.com/prometheus-operator/kube-prometheus/issues/926

Which didn't work.

So... How should I remove the AKS default metrics-server?

rouke-broersma commented 1 month ago

If that is the case I suggest you open a support ticket with azure. Both components are provided by the same team and as such they should work together nicely. If they don't, that's something you should figure out with support. You shouldn't delete AKS managed components manually, that is never the solution when you're using a managed service.

JoeyC-Dev commented 1 month ago

Only one metric server is allowed in the Kubernetes cluster. Because of that the KEDA add-on should be the only metrics server inside the cluster.

That statement is not accurate, this should be "external metric server", not "metric server". image

Src: https://keda.sh/docs/2.14/faq/#can-i-run-multiple-metric-servers-serving-external-metrics-in-the-same-cluster

Or it is already against itself, like below: image

If you check the official document, you will find out three different types of metrics: image Src: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-metrics-apis

microsoft-github-policy-service[bot] commented 1 month ago

@Azure/aks-pm issue needs labels

microsoft-github-policy-service[bot] commented 1 month ago

@Azure/aks-pm issue needs labels

microsoft-github-policy-service[bot] commented 3 weeks ago

@Azure/aks-pm issue needs labels

microsoft-github-policy-service[bot] commented 2 weeks ago

@Azure/aks-pm issue needs labels

microsoft-github-policy-service[bot] commented 1 week ago

@Azure/aks-pm issue needs labels

microsoft-github-policy-service[bot] commented 3 days ago

@Azure/aks-pm issue needs labels