chapter two

2 Kubernetes & GitOps

 

This chapter covers:

  • What problem Kubernetes is trying to solve
  • How to run and manage Kubernetes locally
  • The basics of GitOps
  • How to implement a simple Kubernetes GitOps operator

2.1       Kubernetes Introduction

Before diving into why Kubernetes and GitOps work so well together, let's talk about Kubernetes itself. This section provides a high-level overview of Kubernetes, how it compares to other container orchestration systems and it’s architecture. We will also have an exercise that demonstrates how to run Kubernetes locally, which will be used for many other exercises in this book. This section is only a brief introduction and refresher to Kubernetes. For a fun but informative overview of Kubernetes, check out “The Illustrated Children’s Guide to Kubernetes” and “Phippy Goes to the Zoo” by the Cloud Native Computing Foundation[8]. If you are completely new to Kubernetes, we recommend you read Kubernetes in Action, by Marko Lukša as a companion to this book. If you are already familiar with Kubernetes and running minikube, you may skip to the exercise at the end of section 2.1.

2.1.1   What Is Kubernetes?

Kubernetes is an open-source container orchestration system released in 2014. OK, but what are containers, and why do you need to orchestrate them?

2.1.2   Other Container Orchestrators

2.1.3   Kubernetes Architecture

2.1.4   Deploying to Kubernetes

2.2       Declarative vs. Imperative Object Management

2.2.1   How Declarative Configuration Works

2.3       Controller Architecture

2.3.1   Controller Delegation

2.3.2   Controller Pattern

2.3.3   NGINX Operator

2.4       Kubernetes + GitOps

2.5       Getting Started with CI/CD

2.5.1   Basic GitOps Operator

2.5.2   Continuous Integration Pipeline

2.6       Summary