Book Image

The Kubernetes Workshop

By : Zachary Arnold, Sahil Dua, Wei Huang, Faisal Masood, Mélony Qin, Mohammed Abu Taleb
Book Image

The Kubernetes Workshop

By: Zachary Arnold, Sahil Dua, Wei Huang, Faisal Masood, Mélony Qin, Mohammed Abu Taleb

Overview of this book

Thanks to its extensive support for managing hundreds of containers that run cloud-native applications, Kubernetes is the most popular open source container orchestration platform that makes cluster management easy. This workshop adopts a practical approach to get you acquainted with the Kubernetes environment and its applications. Starting with an introduction to the fundamentals of Kubernetes, you’ll install and set up your Kubernetes environment. You’ll understand how to write YAML files and deploy your first simple web application container using Pod. You’ll then assign human-friendly names to Pods, explore various Kubernetes entities and functions, and discover when to use them. As you work through the chapters, this Kubernetes book will show you how you can make full-scale use of Kubernetes by applying a variety of techniques for designing components and deploying clusters. You’ll also get to grips with security policies for limiting access to certain functions inside the cluster. Toward the end of the book, you’ll get a rundown of Kubernetes advanced features for building your own controller and upgrading to a Kubernetes cluster without downtime. By the end of this workshop, you’ll be able to manage containers and run cloud-based applications efficiently using Kubernetes.
Table of Contents (20 chapters)
Preface

Creating Controllers with Custom Logic

As mentioned earlier, Kubernetes provides a list of controllers with predefined functionality. These controllers are baked into the Kubernetes server binary. However, what happens if you need to have your own policy or standard to check against, and none of the admission controllers fit your requirements?

To address such a requirement, Kubernetes provides something called admission webhooks. There are two types of admission webhooks, which we will study in the following sections.

The Mutating Admission Webhook

The mutating admission webhook is a type of mutating admission controller that doesn't have any logic of its own. Instead, it allows you to define a URL that will be called by the Kubernetes API server. This URL is the address to our webhook. Functionally, a webhook is an HTTPS server that accepts requests, processes them, and then responds back.

If multiple URLs are defined, they are processed in a chain, that is, the output...