how to update max replicas in running pod

1/31/2019

I'm looking to update manually with the command kubectl autoscale my maximum number of replicas for auto scaling.

however each time I run the command it creates a new hpa that fails to launch the pod why I don't know at all:(

Do you have an idea how i can update manually with kubectl my HPA ?

https://gist.github.com/zyriuse75/e75a75dc447eeef9e8530f974b19c28a

-- morla
autoscaling
kubernetes
kubernetes-ingress

1 Answer

1/31/2019

I think you are mixing two topics here, one is manually scale a pod (you can do it through a deployment applying kubectl scale deploy {mydeploy} --replicas={#repl}). In the other hand you have HPA (Horizontal Pod AutoScaler), in order to do this (HPA) you should have configured any app metrics provider system e.g:

then you can create a HPA to handle your autoscaling, you can get more info on this link https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/

Once created you can patch your HPA or deleted it and create it again

kubectl delete hpa hpa-pod -n ns-svc-cas

kubectl autoscale hpa-pod --min={#number} --max={#number} -n ns-svc-cas

easiest way

-- cperez08
Source: StackOverflow