Skip to Content
Policy as Code
book

Policy as Code

by Jimmy Ray
July 2024
Intermediate to advanced
556 pages
13h 27m
English
O'Reilly Media, Inc.
Audio summary available
Content preview from Policy as Code

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:

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

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

The Manager's Path

The Manager's Path

Camille Fournier
Data Governance: The Definitive Guide

Data Governance: The Definitive Guide

Evren Eryurek, Uri Gilad, Valliappa Lakshmanan, Anita Kibunguchy-Grant, Jessi Ashdown

Publisher Resources

ISBN: 9781098139179Errata Page