Autoscaler not adding node based on nodeSelector #597
-
Hi, Setup:
Cluster Autoscaler logs
Part of kube.tf autoscaler_nodepools = [
{
name = "autoscaler-small"
server_type = "cpx21", # must be same or better than the control_plane server type (regarding disk size)!
location = "ash",
labels = [
"location=ash",
"cores=3",
"memory=4",
"disk=40",
"type=autoscaler",
"size=small"
],
min_nodes = 0
max_nodes = 15
}, Deployment YAML apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: my-app
name: my-app
namespace: test
spec:
replicas: 1
selector:
matchLabels:
app: my-app
spec:
containers:
image: 'myimage.com/myimage'
imagePullPolicy: Always
name: my-app
ports:
- containerPort: 8080
name: http
protocol: TCP
resources: {}
nodeSelector:
size: small
type: autoscaler
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
# .... |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
@ifeulner Any ideas on this? |
Beta Was this translation helpful? Give feedback.
-
@v-petukhov Indeed not the right place to ask that, but the answer is no, labels are not supported for autoscaler nodes at this point, but it could be done, please do not hesitate to open a feature request or submit a PR. |
Beta Was this translation helpful? Give feedback.
-
On EKS this works by constructing a 'pseudo node' and checking if the nodeSelector/affinity matches the node: But I suppose this is not possible with the Hetzner CA provider? Maybe this is something worth implementing to make it possible to use scale-to-0-nodegroups in combination with nodeSelector/affinity. |
Beta Was this translation helpful? Give feedback.
Actually, it's possible to add labels, just because when an autoscaled node starts, it uses our own cloud-init, and in there we can pipe the labels and give it to the k3s node config.
But you are right, it would be informational only, not really related to the logic of the autoscaler itself.