Declarative Infrastructure

Kubernetes is inherently a declarative system. In prior chapters, we have explored Kubernetes and some of its key concepts using commands such as kubectl run and kubectl expose. These commands are all imperative: do this thing now. Kubernetes does this by managing these resources as objects themselves. kubectl and the API server translate these requests into resource representations, and then store them, and it is the job of the various controllers to understand the current state and make it as requested.

We can take advantage of the declarative structures directly—all the Services, Pods, and more can be represented by either JSON or YAML files. In this chapter, we will move to define your applications as a declarative ...

Get Kubernetes for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.