5,321
edits
Line 444: | Line 444: | ||
# Annotate existing deployments and statefulsets with replica count. | # Annotate existing deployments and statefulsets with replica count. | ||
kubectl get deploy -o jsonpath='{range .items[*]}{"kubectl annotate --overwrite deploy "}{@.metadata.name}{" previous-size="}{@.spec.replicas}{" \n"}{end}' | sh | kubectl get deploy -o jsonpath='{range .items[*]}{"kubectl annotate --overwrite deploy "}{@.metadata.name}{" previous-size="}{@.spec.replicas}{" \n"}{end}' | sh | ||
kubectl get sts -o jsonpath='{range .items[*]}{"kubectl annotate --overwrite | kubectl get sts -o jsonpath='{range .items[*]}{"kubectl annotate --overwrite sts "}{@.metadata.name}{" previous-size="}{@.spec.replicas}{" \n"}{end}' | sh | ||
# Scale to 0. | # Scale to 0. | ||
Line 454: | Line 454: | ||
# Scale back up. | # Scale back up. | ||
kubectl get deploy -o jsonpath='{range .items[*]}{"kubectl scale deploy "}{@.metadata.name}{" --replicas="}{.metadata.annotations.previous-size}{"\n"}{end}' | sh | kubectl get deploy -o jsonpath='{range .items[*]}{"kubectl scale deploy "}{@.metadata.name}{" --replicas="}{.metadata.annotations.previous-size}{"\n"}{end}' | sh | ||
kubectl get sts -o jsonpath='{range .items[*]}{"kubectl scale | kubectl get sts -o jsonpath='{range .items[*]}{"kubectl scale sts "}{@.metadata.name}{" --replicas="}{.metadata.annotations.previous-size}{"\n"}{end}' | sh | ||
</syntaxhighlight> | </syntaxhighlight> | ||