Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Slack Engineering 10 min read Case study mediumAdept

Advanced Rollout Techniques: Custom Strategies for Stateful Apps in Kubernetes

Slack built the Bedrock Rollout Operator, a Kubebuilder-based Kubernetes operator that drives StatefulSet rollouts through a StatefulsetRollout custom resource. It runs StatefulSets with the OnDelete strategy, which gives percent-based phases, parallel Pod evictions bounded by the PodDisruptionBudget, pause, Consul health checks, Slack notifications and callbacks to the deploy system. RollingUpdate's one-Pod-at-a-time pace was too slow, and StatefulSet maxUnavailable is unavailable on EKS. Instead of event-driven watches, the reconcile loop takes one action per pass, stores the phase in the resource status, and re-enqueues itself, which avoids races and keeps each pass fast. Lessons include notification rate limits on 1,000-Pod StatefulSets, fixed by batching 50 Pods per message, and a "version leak": a paused partial rollout drifts toward the new version as nodes get replaced.

Related posts

  • Make Before Break - Faster Scaling Mechanics for ClickHouse Cloud

    ClickHouse mediumAdept

    ClickHouse Cloud replaced rolling-restart vertical scaling with Make-Before-Break (MBB) scaling: new, correctly sized replicas are added before old ones are removed. This avoids multi-hour resizes, since graceful eviction can wait up to 60 minutes per pod for long-running queries. It also avoids overloading the surviving replicas while one is out of rotation. Ordinal-based StatefulSets cannot remove arbitrary pods, so the operator was refactored to run one StatefulSet per server pod (MultiSTS). Existing services were migrated live through a dedicated migration controller, a mutex so only one controller reconciles a resource at a time, a partial maintenance mode, and Temporal workflows that batch and track thousands of migrations.

  • Executing Cron Scripts Reliably At Scale

    Slack Engineering mediumAdept

    Slack replaced a single cron box running all scripts from one crontab with a distributed cron execution service built mostly from existing infrastructure. A Go "Scheduled Job Conductor" on Kubernetes (Bedrock) uses leader election so one pod schedules while standby pods wait to take over, and it avoids shutting down at the top of a minute. The heavy work is offloaded to Slack's Kafka/Redis-backed Job Queue, which runs about 9 billion jobs a day. A Vitess table records each run's state, replacing flock-based locking for deduplication and backing a status page for engineers. The team chose a single active scheduler over synchronizing multiple nodes because leader failover is fast and scripts don't execute on the scheduler itself.

  • Avoiding Kubernetes Pod Topology Spread Constraint Pitfalls

    Wise Engineering mediumAdept

    Kubernetes Pod Topology Spread Constraints with a naive LabelSelector (e.g. just the app label) can produce heavy zone skew during rolling updates, because kube-scheduler counts Pods from both old and new ReplicaSets and never rebalances when old Pods are randomly terminated. In the worst case an Availability Zone outage could take out 2/3 of a service's Pods instead of 1/3. Wise fixed this with a mutating admission webhook that adds a per-ReplicaSet UUID label to Pods and to the constraint's LabelSelector, so only new-version Pods are considered. Alternatives include manifest tooling changes, the alpha matchLabelKeys field with pod-template-hash in Kubernetes 1.25, descheduler for scale-down imbalance, or per-zone deployments or clusters.

  • Continuous Load Testing

    Slack Engineering mediumAdept

    Slack moved to running its Koi Pond load-testing clients continuously, 24/7, against an organization 4x the size of its largest customer. Performance regressions get caught on every deploy without the cost of spinning up test environments. Making this safe required an Automatic Shutdown service that polls Prometheus via Trickster and stops tests when thresholds are breached (e.g. API success below 95% for five minutes), partial shutdown and Emergency Stop controls, DynamoDB-backed persistence so the Keeper survives pod restarts, and automated token generation via cron, job queues, exponential-backoff retries and encrypted S3 storage. A gradual rollout from 5,000 to 500,000 clients with cross-team communication produced zero off-hours pages in six months, and an ad-hoc test that once took a day of effort now takes minutes.

  • BuildRock: A Build Platform at Slack

    Slack Engineering mediumAdept

    Slack consolidated its sprawling, hand-managed "snowflake" Jenkins clusters into BuildRock, a build-as-a-service platform. Jenkins controllers run statelessly on Kubernetes, configured through the Configuration-as-Code (casc) plugin and Jinja2 templates, and every change flows through GitOps, so a cluster can be rebuilt identically from Git. State such as build history lives on EFS with automated backups, plugins come from central storage, vulnerability scanning runs on every build, and test and pre-staging clusters catch problems before production. Rollout was incremental: controllers moved to Kubernetes before agents, with static EC2 agents alongside ephemeral pods, and old clusters were kept on standby for fast rollback under a shared ownership model with service teams.

The quest for software engineering knowledge.

Look:
Layout: