Slide 1

Slide 1 text

Kubernetes GitOps at Cloudflare Terin Stock Cloud-Native and Kubernetes Silicon Valley Meetup January 16 2020

Slide 2

Slide 2 text

Terin Stock @terinjokes Software Engineer

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

“How do we do releases?” ● Had three goals in mind when picking a workflow: ○ Continuous ○ Automatic ○ Reviewable

Slide 5

Slide 5 text

The Status Quo

Slide 6

Slide 6 text

Status Quo of Releases ● Build server manages releases of the master branch ● Release artifacts and manifests built at the same time ● Releases are automatically promoted

Slide 7

Slide 7 text

Status Quo of Releases ● Our workflow goals: ○ Automated ✔ ○ Continuous ❌ ○ Reviewable ❌

Slide 8

Slide 8 text

Non-Continuous Releases ● Modifications made with kubectl are not reverted until the next time the build server ran ○ In practice, the next time code was merged to master ○ Development cadence of software differs ● System state can easily diverge, often being fatal to future releases.

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Non-Reviewable Releases ● Manifests are generated by the build server behind the scenes. ○ Difficult to review what will be released ○ Difficult to stagger promotions ● Build server enforced templating system ○ Had to hack around templating if tasks weren't simple

Slide 11

Slide 11 text

GitOps Workflow

Slide 12

Slide 12 text

GitOps Workflow ● Consider a git repository has the source of truth for Kubernetes manifests. ● Any changes that reach master are deployed to Kubernetes ○ In fact, they're continuously deployed to Kubernetes ● Can restore a previous release with git revert.

Slide 13

Slide 13 text

Reviewable Releases ● Git has a powerful tool for reviews: a pull request! ● The manifests are directly deployed; no need to parse and understand a template.

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Automating Releases ● A task on the build server generates the release manifests. ○ Output is captured and opened as a pull requests on the manifests repository. ○ Capturing output allows teams to select best tools for their project.

Slide 16

Slide 16 text

Automating Releases ● For releases to multiple environments, multiple pull requests can be made. ○ Gives flexibility to stagger releases where required ○ Cancel releases by declining the pull request

Slide 17

Slide 17 text

Continuous Releases ● Tools running in Kubernetes monitor the git repository ○ Patches are applied to Kubernetes resources to bring them in sync. ● Currently using kube-applier and git-sync

Slide 18

Slide 18 text

Continuous Releases ● Starting migration to Pusher's Faros controller ○ CRDs track changes and removals ○ Maintains synchronized status fields

Slide 19

Slide 19 text

GitOps Workflow ● Our workflow goals: ○ Automated ✔ ○ Continuous ✔ ○ Reviewable ✔

Slide 20

Slide 20 text

GitOps all the things!

Slide 21

Slide 21 text

Thanks ● Fill free to ask me questions afterwards. ○ @terinjokes

Slide 22

Slide 22 text

Back Matter

Slide 23

Slide 23 text

Colophon The main body text, including headers, were set in Cambo by Argentinian foundry Huerta Tipográfica based on the style of traditional Khmer type. Monospace text was set in Anonymous Pro by Minnesota font designer Mark Simonson. It was inspired by mid-90s freeware Macintosh font Anonymous 9.