Juan Pablo Converso
12/19/2023, 6:43 PMapiVersion: flink.apache.org/v1beta1
kind: FlinkDeployment
metadata:
name: basic
spec:
image: flink:1.17
flinkVersion: v1_17
ingress:
template: "{{name}}.{{namespace}}.flink.k8s.io"
className: "nginx"
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: 50m
flinkConfiguration:
taskmanager.numberOfTaskSlots: "1"
serviceAccount: flink
jobManager:
resource:
memory: "1024m"
cpu: 1
taskManager:
replicas: 1
resource:
memory: "1024m"
cpu: 1
Flink Jobs are running perfectly. For auto-scaling I created HPA using the following code.
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: basic-hpa
namespace: default
spec:
minReplicas: 1
maxReplicas: 3
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageValue: 40
scaleTargetRef:
apiVersion: flink.apache.org/v1beta1
kind: FlinkDeployment
name: basic
While describing the auto scaling I am getting below mentioned error.
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedComputeMetricsReplicas 6m23s (x12 over 9m8s) horizontal-pod-autoscaler selector is required
Warning SelectorRequired 4m8s (x21 over 9m8s) horizontal-pod-autoscaler selector is required`
And when doing a "kubectl describe hpa simple-flink" I get the following status info:
status:
conditions:
- lastTransitionTime: "2023-12-19T13:42:00Z"
message: the HPA controller was able to get the target's current scale
reason: SucceededGetScale
status: "True"
type: AbleToScale
- lastTransitionTime: "2023-12-19T13:42:00Z"
message: the HPA target's scale is missing a selector
reason: InvalidSelector
status: "False"
type: ScalingActive`
I've tried as suggested in this other thread: https://stackoverflow.com/questions/73075996/flink-kubernetes-deployment-the-hpa-controller-was-unable-to-get-the-targets to execute the following to update the CRD to the last version:
git clone https://github.com/apache/flink-kubernetes-operator
cd flink-kubernetes-operator
kubectl replace -f helm/flink-kubernetes-operator/crds/flinkdeployments.flink.apache.org-v1.yml
After that I recreated the deployment and the HPA but I get the same error.
I'm not sure if HPA is supported with the flink-kubernetes-operator.
Thanks a lot for any suggestion on how to fix this problemGyula F贸ra
12/19/2023, 8:18 PMGyula F贸ra
12/19/2023, 8:18 PMGyula F贸ra
12/19/2023, 8:18 PMGyula F贸ra
12/19/2023, 8:18 PMJuan Pablo Converso
12/19/2023, 11:44 PMGyula F贸ra
12/20/2023, 5:06 AMGyula F贸ra
12/20/2023, 5:07 AMJuan Pablo Converso
12/20/2023, 2:58 PMJuan Pablo Converso
12/20/2023, 8:40 PMflinkConfiguration:
parallelism.default: "1"
taskmanager.numberOfTaskSlots: "1"
state.savepoints.dir: file:///flink-data/savepoints
state.checkpoints.dir: file:///flink-data/checkpoints
high-availability.type: kubernetes
high-availability.storageDir: file:///flink-data/ha
rest.client-max-content-length: "1004857600"
job.autoscaler.enabled: "true"
job.autoscaler.stabilization.interval: 1m
job.autoscaler.metrics.window: 1m
job.autoscaler.target.utilization: "0.7"
job.autoscaler.target.utilization.boundary: "0.2"
job.autoscaler.restart.time: 2m
job.autoscaler.catch-up.duration: 5m
pipeline.max-parallelism: "1"
Then I tried to run this job using a parallelism of 6
./bin/flink run --jobmanager flink.default.flink.k8s.io:80 -pyexec python3 -p6 -pyclientexec python3 --python ./original/python/table/basic_operations.py
But I expected that I get only one task manager running but I got 6 instead of the expected 1.
NAME READY STATUS RESTARTS AGE
flink-68476b87dd-29bpq 1/1 Running 0 34m
flink-taskmanager-1-10 1/1 Running 0 8s
flink-taskmanager-1-11 1/1 Running 0 8s
flink-taskmanager-1-12 1/1 Running 0 8s
flink-taskmanager-1-7 1/1 Running 0 8s
flink-taskmanager-1-8 1/1 Running 0 8s
flink-taskmanager-1-9 1/1 Running 0 8s
What I'd like is to limit the amount of taskManagers to a fixed max amount even if the jobs sent to the jobmanager set different parallelisms to avoid exceding the resource limits of the Kubernetes namespace.
Thanks for any advice! 馃榾Gyula F贸ra
12/20/2023, 8:44 PMGyula F贸ra
12/20/2023, 8:44 PMGyula F贸ra
12/20/2023, 8:44 PMGyula F贸ra
12/20/2023, 8:45 PMGyula F贸ra
12/20/2023, 8:45 PMGyula F贸ra
12/20/2023, 8:45 PMGyula F贸ra
12/20/2023, 8:46 PMGyula F贸ra
12/20/2023, 8:47 PMJuan Pablo Converso
12/20/2023, 9:35 PM