- Lab
- A Cloud Guru
Test a Dynamic Admission Controller with Terraform
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.
Path Info
Table of Contents
-
Challenge
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.
-
-
Challenge
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.
-
-
Challenge
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.
-
-
Challenge
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:
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.