Exam CKS Topic 1 Question 131 Discussion
Actual exam question for Linux Foundation's CKS exam
Question #: 131
Topic #: 1
Question #: 131
Topic #: 1
You are deploying a critical application on your Kubernetes cluster. You want to ensure that only certified and trusted container images are allowed to be deployed- How can you implement an Image Signature Verification process to ensure that all images pulled from your Docker registry are signed with a trusted key?
Suggested Answer:
Solution (Step by Step) :
1. Generate Key Pair: Generate a public and private key pair for signing container images.
bash
openssl genrsa -out private-key 2048
openssl rsa -pubout -in private-key -out public-key
2. Sign Container Image: use the private key to sign the container image-
bash
docker build -t my-app:latest
cosign Sign --key private.key my-app:latest
3. Push Signed Image: Push the signed image to your Docker registry.
bash
docker push my-app:latest
4. Configure Kubernetes Image Policy: Configure a Kubernetes ImagePolicyWebhook using a tool like Admission Webhook Controller to enforce image signature verification. The webhook can be configured to check for the presence of a valid signature using the public key and to reject images without a valid signature.

5. Deploy Image Policy Webhook: Deploy the ImagePolicyWebhook configuration using 'kubectl apply -f image-policy-webhook.yamr 6. Test Image Signature Verificatiom Create a new Deployment using an unsigned image. The deployment should be rejected by the webhook.

Note: This is a basic example. You can configure more advanced image signature verification policies based on your security needs and requirements. For example, you can enforce specific image signing policies, use multiple keys, and configure different failure policies.
1. Generate Key Pair: Generate a public and private key pair for signing container images.
bash
openssl genrsa -out private-key 2048
openssl rsa -pubout -in private-key -out public-key
2. Sign Container Image: use the private key to sign the container image-
bash
docker build -t my-app:latest
cosign Sign --key private.key my-app:latest
3. Push Signed Image: Push the signed image to your Docker registry.
bash
docker push my-app:latest
4. Configure Kubernetes Image Policy: Configure a Kubernetes ImagePolicyWebhook using a tool like Admission Webhook Controller to enforce image signature verification. The webhook can be configured to check for the presence of a valid signature using the public key and to reject images without a valid signature.

5. Deploy Image Policy Webhook: Deploy the ImagePolicyWebhook configuration using 'kubectl apply -f image-policy-webhook.yamr 6. Test Image Signature Verificatiom Create a new Deployment using an unsigned image. The deployment should be rejected by the webhook.

Note: This is a basic example. You can configure more advanced image signature verification policies based on your security needs and requirements. For example, you can enforce specific image signing policies, use multiple keys, and configure different failure policies.
by Cornell at Nov 04, 2025, 04:43 PM
0
0
0
10
Comments
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Report Comment
Commenting
You can sign-up / login (it's free).