In a K8S course I watched it was mentioned that Cluster Autoscaler can only work if you defined resources requests.
I deployed this yaml file (without resources requests & limits) to my EKS cluster, and I see that the autoscaler works pretty fine, it scales up and down even though I didn't define resources.
apiVersion: apps/v1
kind: Deployment
metadata:
name: php-apache
spec:
selector:
matchLabels:
run: php-apache
replicas: 20
template:
metadata:
labels:
run: php-apache
spec:
containers:
- name: php-apache
image: k8s.gcr.io/hpa-example
ports:
- containerPort: 80
# resources:
# requests:
# cpu: 999m
# memory: 256Mi
# limits:
# cpu: 1000m
# memory: 512Mi
My question is:
Is it really necessary to define resources requests for Cluster Autoscaler? If so, how come that I see the CA scales up and down in this case?
My goal is to find a way to skip the resource requests. Developers in my company define very high resources requests and limits, which causes a waste of actual resources.
I though that if I remove the resources requests and limits, the CA will use the ACTUAL resources that the app needs, and not more than that as the developers define.
So if must define resources requests, how else can I solve the situation described above?
Thanks in advance.