Scale All the deployments of the single namespace to Specific Number. Useful when wants to Scale diffrent environments.
kubectl scale deploy -n dev --replicas=3 --all
Edit HPA For the Whole Namespace with Single liner:
for deployment in $(kubectl get deployments -o jsonpath='{.items[*].metadata.name}' -n <namespace>); do
kubectl autoscale deployment $deployment --min=<min-replicas> --max=<max-replicas> --cpu-percent=<cpu-percent>
done