In this lab, you will be asked to test the dynamic admission controller with test pods that you will create and deploy with Terraform. Two of the pods will have labels that will match the validating webhooks policy, and one of the test pods will not.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Lab Setup
Move to the
validating-admission-webhook
directory.Create an access key in the AWS Management Console.
Note: You need to copy the access key ID and secret key somewhere safe and accessible for the next step.
Make the
lab-setup.sh
script executable.Run the
lab-setup.sh
script.Note: This script will run for about 10–15 minutes.
- Create and Deploy the Webhook
Move to the
validating-webhook
directory.Log in to Docker Hub from the command line.
Update the
Makefile
with your Docker Hub username.Build the webhook.
Note: This can take 5–10 minutes.
Build the Docker image.
Push the Docker image to Docker Hub.
Deploy the certs.
Deploy the validating webhook.
- Create and Deploy the Test Pods with Terraform
Create a directory called
test-pods
.Move to the
test-pods
directory.Create three test pods called
test-app-1
,test-app-2
, andtest-app-3
, and add a label calledhello = "world"
totest-app-2
andhello = "universe"
totest-app-3
.Initialize your working directory.
Apply the webhook configuration.
- Confirm the Dynamic Admission Controller Is Working
- Confirm that your validating webhook is working:
test-app-1
should error and not deploy.test-app-2
andtest-app-3
should deploy without issue.
- Confirm that your validating webhook is working: