Chapter 7. OPA/Gatekeeper and Kubernetes
When it comes to PaC solutions for Kubernetes API server requests, OPA/Gatekeeper—a.k.a. Gatekeeper—is one the most popular solutions. Gatekeeper is underpinned by OPA; however, it is designed to use native Kubernetes CRDs to build policies for mutation and validation. Using the CRDs and the Constraint Framework—covered later in this chapter—promotes the expressiveness and reusability of Gatekeeper policies.
Gatekeeper is a very mature OSS project with a strong and active community of developers and users. The following links will help you gain more information about Gatekeeper:
-
Slack community: #opa-gatekeeper
In this chapter, we will explore Gatekeeper, examining how it is installed and used. Along the way, I will cover topics like policies, the Constraint Framework, and different modes of operation. Finally, I will describe three features that were recently added to ease adoption of Gatekeeper: external data providers, policy expansion, and the gator CLI.
Let’s begin with installing and configuring Gatekeeper to operate—and play nice—in your clusters.
Installation
There are multiple ways to install Gatekeeper:
-
kubectl
-
Helm
-
make
Since multiple resources are installed at the cluster level and at the Namespace level, I prefer to use the package-manager approach of Helm:
# Add helm repo $ helm repo add gatekeeper \ https://open-policy-agent.github.io/gatekeeper/charts ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access