-
Notifications
You must be signed in to change notification settings - Fork 82
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
Scaling of pods is not happening as per the http requests #1005
Comments
Hello, |
These are the logs of KEDA operator please check it |
Please find the logs attached, Thanks |
Find the http-interceptor logs |
I have followed 3 methods for scaling the http pods and the links for them are as follows https://medium.com/@carlocolumna/how-to-scale-your-pods-based-on-http-traffic-d58221d5e7f1 In the above link I have faced issue while handling the host during the curl command with the host In the above link I have faced the issue after this step https://knowledgebase.eo-lab.org/en/latest/kubernetes/HTTP-Request-based-Autoscaling-on-K8S-using-Prometheus-and-Keda-on-EO-Lab.html |
The interceptor hasn't received any request. Could you double check the connections? If everything looks well, could you share all the related manifests?
|
@Manikiran88888 , could you share the info please? |
Hey, I am sharing the zip folder which consists
please check the files and let me know if any thing required If you are able to scale the pods using the files which I have sent please share me the exact steps so that I will follow the same |
I only see 2 request in the interceptor: {"level":"info","ts":1714551507.0846822,"logger":"LoggingMiddleware","caller":"middleware/logging.go:73","msg":"127.0.0.1:51490 - - [01/May/2024:08:18:27 +0000] \"GET / HTTP/1.1\" 404 9 \"\" \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36\""}
{"level":"info","ts":1714551507.1441922,"logger":"LoggingMiddleware","caller":"middleware/logging.go:73","msg":"127.0.0.1:51490 - - [01/May/2024:08:18:27 +0000] \"GET /favicon.ico HTTP/1.1\" 404 9 \"http://127.0.0.1/\" \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36\""} Both returning 404. I see that you are calling using |
Assuming that you HTTPScaledObject sets curl -H `Host: myhost.com` http://127.0.0.1/favicon.ico and that should trigger the scaling out and give you the favicon |
Powershell doesn't have a real curl command, that's why you see that error. $headers = @{
"Host" = "myhost.com"
}
$response = Invoke-WebRequest -Uri "http://127.0.0.1/favicon.ico" -Headers $headers You need to pass the |
The other option can be editing the host file to include a mapping between your host and 127.0.0.1. |
I want to know one more thing why should I use (http://127.0.0.1/favicon.ico) I am asking out of curiosity I want to know why favicon.ico came here Is it okay if I use curl -H |
oh, yeah, you should use the port too. |
Do you want to generate the load from your laptop directly? I suggest using ab within cluster |
apiVersion: batch/v1
kind: Job
metadata:
name: load-generator
namespace: WHERE_YOU_WANT
spec:
template:
spec:
containers:
- name: apache-ab
image: ghcr.io/kedacore/tests-apache-ab
imagePullPolicy: Always
args:
- "-n"
- "20000" #Total requests
- "-c"
- "1" #Concurrent clients
- "-H"
- "Host: YOUR_HOST"
- "http://YOUR_INGRESS_SERVICE.YOUR_INGRESS_NAMESPACE:YOUR_INGRESS_PORT/"
restartPolicy: Never
terminationGracePeriodSeconds: 5
activeDeadlineSeconds: 600
backoffLimit: 5 |
This will generate the load directly inside the cluster, hitting your ingress and passing over all the components, but you can hit directly the add-on interceptor service if you prefer, as you wish |
How can we hit the add-on interceptor service directly any reference ? I would like to check it please |
About how to configure the scaling and metrics/thresholds, you could be interested on this feature that will be released soon as part of v0.8.0: #961 |
apiVersion: batch/v1
kind: Job
metadata:
name: load-generator
namespace: WHERE_YOU_WANT
spec:
template:
spec:
containers:
- name: apache-ab
image: ghcr.io/kedacore/tests-apache-ab
imagePullPolicy: Always
args:
- "-n"
- "20000" #Total requests
- "-c"
- "1" #Concurrent clients
- "-H"
- "Host: YOUR_HOST"
- "http://INTERCEPTOR_SERVICE.KEDA_NAMESPACE:INTERCEPTOR_SERVICE_PORT/"
restartPolicy: Never
terminationGracePeriodSeconds: 5
activeDeadlineSeconds: 600
backoffLimit: 5 Basically you can use this job pointing to any level on top of interceptor just changing the last line to call to the layer that you want
|
Hey, Also one more thing is that How much ever I do I could not scale up the pods could you please have a look and try to do it on your PC because it is just a sample nginx image which I want to test |
You can see the reference page for the HTTPScaledObject here: https://kedacore.github.io/http-add-on/ref/v0.8.0/http_scaled_object.html |
I've just deployed your resources on my own cluster, and deployed this job into the cluster: apiVersion: batch/v1
kind: Job
metadata:
name: load-generator
spec:
template:
spec:
containers:
- name: apache-ab
image: ghcr.io/kedacore/tests-apache-ab
imagePullPolicy: Always
args:
- "-n"
- "2000000" #Total requests
- "-c"
- "400" #Concurrent clients
- "-H"
- "Host: myhost.com"
- "http://keda-add-ons-http-interceptor-proxy.keda:8080/test"
restartPolicy: Never
terminationGracePeriodSeconds: 5
activeDeadlineSeconds: 600
backoffLimit: 5 You have to ensure that your requests reach the nginx, as your HTTPScaledObject defines the path Assuming that all the traffic reach the monitored workload, you can try modifying the HTTPScaledObject to use the new aggregated metrics, just adding this section:
This will be more accurate for the scaling, but this feature has been released today as part of v0.8.0 |
Okay |
Yeah, that's not correct, you can see the correct spec here: https://github.com/kedacore/http-add-on/blob/main/docs/ref/v0.8.0/http_scaled_object.md
|
My Httpobjectscode is kind: HTTPScaledObject
apiVersion: http.keda.sh/v1alpha1
metadata:
name: test-httpscale
spec:
hosts:
- myhost.com
pathPrefixes:
- /test
scaleTargetRef:
name: nginx-test-app
kind: Deployment
apiVersion: apps/v1
service: nginx-test-app
port: 80
replicas:
min: 0
max: 10
scaledownPeriod: 100
requestRate:
granularity: 1s
targetValue: 100
window: 1m` Should I need to change anything here |
Thanks for your support on the http topic |
Hey, After applying the scaling if we want to access the webpage in the browser which has to trigger my Http request and should scale up the pods |
Instead of generating the load using the code, I want to open the nginx in the browser and I want to see if it is scaling my pods or not |
Hey, I have forwarded my interceptor proxy but when I try to use the curl command and check the response from the nginx server these is a not found response I am getting but it is scaling the pods Is there anything I am missing or Is there any issue could you please support on it |
Which is the issue? You are forwarding the request correctly. I mean, you open a port to the interceptor service, and you are calling to it and the interceptor is proxying the request to nginx because that message is from nginx, so it's working as expected. I guess that you want to open your browser and call to localhost port-forwarded port. Am I right? If yes, it won't work unless you set the headers in your requests using a plugin or so. e.g: https://chromewebstore.google.com/detail/modheader-modify-http-hea/idgpnmonknjnojddfkpgkljpfnnfcklj?pli=1 The problem is that the interceptor routes the traffic based on the |
The problem is that your HTTPScaledObject doesn't have set localhost as valid domain. You can try modifying the HTTPScaledObject to include localhost within In any case, the about the picture using curl, that message is given by the backend, not by the interceptor. If you want to call to any route, you have to replace |
It worked me for nginx server and it ran properly and when I try to deploy my application apiVersion: apps/v1 kind: Service it is not running and the steps I followed the same how I did for nginx |
The message is quite clear, the connection has been refused 😄. Most probably because your pod doesn't listen the port 9090 despite it's the configured in k8s side. What do you see if you try to port-forward that port or make a request from any other pod within the cluster? |
If I try to port forward it, the app is working fine and it is being accessible |
Do you have network policies or any kind of network management (service mesh, firewall, etc)? |
no actually I am running a fastapi service application and it is giving the error |
This is the sample code of Fastapi which I am trying to run but it is not executing I have included the readme inside the zip file I have deployed it and scaled it also forwarded the port of the interceptor but when I try the curl command it is not responding it is giving bad gateway |
This picture isn't related with this comment #1005 (comment) The picture is pointing to port 9000 and your API doesn't expose that port. Please, don't change all the things all the time without clarifying the change because I'm lost and IDK what you are trying now. |
Could you please clarify which is the current scenario?:
|
What are you deploying?
What are you executing to validate it?
Which is the exact error that you are seeing? Which is the exact behavior that you are facing? |
There are 2 failures:
Basically, if you change your container to this: - name: nginx-test-app
image: jorturfer/fts # use your image name here
ports:
- containerPort: 8008
readinessProbe:
httpGet:
path: /
port: 8008
scheme: HTTP You will see how it works perfectly. |
Okay |
Hey, |
Good Morning, |
Hello, FROM python:3.10.12-slim
WORKDIR /app
COPY . /app/
RUN pip3 install fastapi uvicorn
CMD [ "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8008" ] The important change is this: |
Thanks A lot |
Report
Scaling of pods is not happening according to the requirements
Expected Behavior
deployment yaml
http scaled object yaml
the scaled object is applied on the deployment
Actual Behavior
The pods should scale up as the load on the http requests is generated but the pods are not scaling
Steps to Reproduce the Problem
Logs from KEDA HTTP operator
HTTP Add-on Version
0.7.0
Kubernetes Version
1.29
Platform
None
Anything else?
No response
The text was updated successfully, but these errors were encountered: