My Question About | Correct Category |
---|---|
Dgraph | Users > Dgraph |
I’m a big fan of the open-source dgraph helm chart. So far everything goes well except for horizontal pod autoscaling. I wonder if the chart supports it or not, if yes, how should I enable it? otherwise, does the high availability fully rely on the amount of alpha & zero replica and nodes run on a kubernetes cluster? Though the guidance Highly Available Cluster Setup is helpful it doesn’t tell anything about HPA.
First I helm installed
Dgraph run as replica 1 for alpha and 1 for zero on a single node. Everything went well.
Then I tried creating a HorizontalPodAutoscaler
template to enable it. However, since Helm installed dgraph doesn’t provide us deployment
resource of Dgraph when I run kubectl get deployment -n ${mynamespace}
, applying the HPA template doesn’t work.
# My HorizontalPodAutoscaler
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: dgraph-release-dgraph-alpha
namespace: demo
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: dgraph-alpha
minReplicas: 1
maxReplicas: 3
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 60
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: dgraph-release-dgraph-zero
namespace: demo
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: dgraph-zero
minReplicas: 1
maxReplicas: 3
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 60
Check HPA, obviously the target reference can not be found nor reached since it lacks the deployment resource.
# Check alpha
kubectl describe hpa dgraph-release-dgraph-alpha -n demo
# output
Name: dgraph-release-dgraph-alpha
Namespace: demo
Labels: <none>
Annotations: <none>
CreationTimestamp: Wed, 04 Oct 2023 19:39:37 -0400
Reference: Deployment/dgraph-alpha
Metrics: ( current / target )
resource cpu on pods (as a percentage of request): <unknown> / 60%
Min replicas: 1
Max replicas: 3
Deployment pods: 0 current / 0 desired
Conditions:
Type Status Reason Message
---- ------ ------ -------
AbleToScale False FailedGetScale the HPA controller was unable to get the target's current scale: deployments/scale.apps "dgraph-alpha" not found
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedGetScale 10s horizontal-pod-autoscaler deployments/scale.apps "dgraph-alpha" not found