Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arunjayakumar01/18c10763665dc912be59f8727d48d845 to your computer and use it in GitHub Desktop.
Save arunjayakumar01/18c10763665dc912be59f8727d48d845 to your computer and use it in GitHub Desktop.

Horizontal pod scaler (HPA) in AWS eks

Check metric server Installed in your cluster
kubectl -n kube-system get deployment/metrics-server
  • If this returns none , add metric server by
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.3.6/components.yaml
  • check status of the metric server
kubectl get deployment metrics-server -n kube-system
HPA Example config
apiVersion: autoscaling/v1  
kind: HorizontalPodAutoscaler  
metadata:  
  name: node-angular-autoscaler  
  namespace: nodeangular  
  labels:  
    app: nodeangular  
spec:  
  scaleTargetRef:  
    apiVersion: apps/v1  
    kind: Deployment  
    name: nodeangular  
  minReplicas: 2  
  maxReplicas: 10  
  targetCPUUtilizationPercentage: 10
  • save this a pod-autoscaler.yaml

  • Add this HPA to cluster by

kubectl apply -f pod-autosacling.yaml 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment