← Writing archive

Scaling Spinnaker at Netflix — The Basics

Originally published in The Spinnaker Community Blog on Medium.

The Backstory

Spinnaker is the continuous delivery platform we’ve been building (and operating) over the past 2 years at Netflix. It represents many years of our team’s collective experiences delivering software at scale and has quickly grown from dozens of deployments per day to the 3000+ we regularly see now.

In partnership with Google, we open sourced Spinnaker in November of 2015 and now have first-class support for AWS, GCP and Kubernetes. Azure, Open Stack and Cloud Foundry is under active development by Microsoft and community members.

For much of 2016, our team has been adding support for Titus, the internal Netflix container cloud.

This post will detail how we scale and operate Spinnaker within Netflix.

Terminology

Cluster : One or more server groups (or ASGs if you speak AWS). For the purpose of Spinnaker, you can assume that a Cluster may contain more than one ASG but that only one would be active at any given time.

Service : A microservice.

Spinnaker Microservices

What follows is a simplistic overview of each Spinnaker service.

  • Deck is a static AngularJS-based UI.
  • Gate exposes APIs for all external consumers of Spinnaker (including deck). It is the front door to Spinnaker.
  • Cloud Driver integrates with each cloud provider (AWS, GCP, Azure, etc.). It is responsible for all cloud provider-specific read and write operations.
  • Orca handles pipeline and task orchestration (ie. starting a cloud driver operation and waiting until it completes).
  • Rosco is a packer-based bakery. We believe in immutable infrastructure and rosco provides a means to take a Debian or Red Hat package and turn it into an Amazon Machine Image. Don’t worry, it also supports Google Compute Engine and Azure images.
  • Front50 stores all application, pipeline and notification metadata.
  • Igor facilitates the use of Jenkins in Spinnaker pipelines (a pipeline can be triggered by a Jenkins job or invoke a Jenkins job).
  • Echo provides Spinnaker’s notification support, including integrations with Slack, Hipchat, SMS (via Twilio) and Email.

Overview

Architecture diagram showing Spinnaker microservices deployed as separate clusters behind a shared entry point

Like all Netflix services, we run Spinnaker in AWS with a few common operating patterns:

  • Every Spinnaker service (ie. deck, gate, orca, etc.) run in their own cluster.
  • Every Spinnaker service emits operational metrics to Atlas. We dashboard and alert off these metrics.
  • Every Spinnaker service emits logs to an Elastic Search + Logstash + Kibana (ELK) stack.
  • Every internal service (ie. everything but deck and gate) uses mutual TLS (mTLS) and an internal certificate authority that our team manages via Lemur. We do not allow external traffic to internal services. All api calls must route through gate.
  • Every external service (ie. gate) supports either mTLS or SSO with the existing Netflix provider. For what it’s worth, deck is a static javascript UI with no real authentication requirements.
  • If a service has a data store dependency, it will have it’s own datastore. We do not share data stores across services.

At Netflix, Spinnaker manages multiple accounts and uses the standard AWS assume role capabilities to index and perform operations across accounts.

Why Cluster per Service?

Short answer: it allows us to maintain a rapid release cadence.

Longer answer: we consider Spinnaker to be the sum of all its services, each of which is independently supported and improved at a relatively rapid pace.

We aim to have any merged commit make it to a staging environment in less then 20 minutes. In the absence of failure, we will promote that individual service to production.

For resiliency, we run at least two instances of each service in different availability zones.

For performance, we may run more than two instances of a particular service. Specifically, we run 3 orca instances and at least 6 cloud driver instances split across primary and read replicas. Yes, that’s right, our read requests are sufficiently high that we decided to point gate at a read-only cloud driver cluster.

Lastly, in the event of failure we appreciate the ability to quickly scale our services up (or down).

Backwards Compatibility

While not perfect, our approach to backwards compatibility is both simple and pragmatic. Adequate unit tests are presupposed.

With many dozens of internal Spinnaker integrations, we take great care to avoid breaking API changes. Most of the time these changes are caught when reviewing a PR.

We have two sets of integration tests running 24/7:

  • A Jenkins job makes a series of API calls against gate and verifies that the results are expected (ie. a security group or server group is created / updated / deleted).
  • A series of Spinnaker pipelines are executed to verify standard behaviors (ie. Bake and Deploy, Canary, etc.). These pipelines are run in both our staging and production environments.

This has largely kept the ship afloat for the past two years and well over 250,000 deploys.

In the event of undetected failure, we simply roll back the offending service (blue/green deployments are the norm) and roll forward when a fix is ready!

There you have it!

Although not mentioned previously, it goes without saying that we deploy Spinnaker with Spinnaker and have done so ever since the earliest days of the project.

Part 2 of this series details how we use metrics and alerts to operate and support Spinnaker in production.

If you’d like to know more about the project: