Menu

1 / 2

We removed replicas from our manifest for the autoscaler and checkout dropped to one pod

DEV Community: kubernetes·Sergey Shinder·4 days ago
#nE0jaeHd
#devtokubernetes#devto#dev#manifest#apply
Reading 0:00
15s threshold

Our checkout Deployment had replicas: 10 in its manifest for two years, and our pipeline applies manifests with kubectl apply. In October we added a HorizontalPodAutoscaler with a minimum of ten and a maximum of forty ahead of Black Friday.

The Kubernetes documentation is clear that once an autoscaler owns a Deployment, the replicas field should come out of the manifest. Otherwise every apply sets the count back to the number in the file, whatever the autoscaler had decided. So a second pull request deleted one line, replicas: 10. It merged at twenty past twelve on a Wednesday. Two minutes later checkout was running on one pod.

kubectl apply decides what to change by comparing three things: the manifest you give it, the live object, and a copy of the previous manifest it keeps in an annotation on the object, last-applied-configuration. A field that was in the previous manifest and is missing from the new one is a field you deleted, so apply removes it from the live object.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.