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

Add more debugging scenarios for not scaling as expected #1298

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions content/troubleshooting/scaledobject-not-scale.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,36 @@
+++
title = "Why is my `ScaledObject` paused?"
title = "Why is my `ScaledObject` not scaling as expected?"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally would prefer a seperate item for this; people using pausing will more likely be helped faster if we have a dedicated item.

You can still refer to the new item from within the paused entry

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree a separate section would be great

weight = 1
+++

When KEDA has upstream errors to get scaler source information it will keep the current instance count of the workload unless the `fallback` section is defined.
There are a number of reasons why your KEDA scaling may not be working as expected,

This behavior might feel like the autoscaling is not happening, but in reality, it is because of problems related to the scaler source.
## Common issues

You can check if this is your case by reviewing the logs from the KEDA pods where you should see errors in both our Operator and Metrics server. You can also check a status of the ScaledObject (`READY` and `ACTIVE` condition) by running following command:
### KEDA scaler source is invalid

When KEDA has upstream errors to get scaler source information it will keep the current instance count of the workload unless the `fallback` section is defined. This behavior might feel like the autoscaling is not happening, but in reality, it is because of problems related to the scaler source.

### DesiredReplicas is within 10% of the target value

If the replica mismatch is within 10% of the target value, you may be experiencing a known issue whereby Kubernetes `HorizontalPodAutoscalers` have a default tolerance of 10%. If your desired value is within 10% of the scaling metric, the HPA will not scale. More detail on this scenario can be found in [this issue against the KEDA project](https://github.com/kedacore/keda/issues/5263) and [this issue against the Kubernetes project](https://github.com/kubernetes/kubernetes/issues/116984).

## Debugging process

### Check KEDA pods for errors

The most effective place to start for debugging your issue is by reviewing the logs from the KEDA pods where you may see errors in both our Operator and Metrics server. You can [enable debug logging](https://github.com/kedacore/keda/blob/main/BUILD.md#setting-log-levels) to provide more verbose output, which may be helpful in some scenarios.

### Check the Kubernetes resources for errors

You can check the status of the `ScaledObject` (`READY` and `ACTIVE` condition) by running following command:

```bash
$ kubectl get scaledobject MY-SCALED-OBJECT
```

It is also possible to check the status conditions on the related HPA itself to determine whether the HPA is also healthy:

```bash
$ kubectl get horizontalpodautoscaler MY-HPA
```