Skip to content

Does kyverno verify that the value of .spec.imagePullSecret for a pod exists in the current cluster? #784

Discussion options

You must be logged in to vote

Thank you for the explanation. Yes, Kyverno can do this quite easily using a context variable to look up Secrets in the same Namespace as the Pod or its controller. Write a validate rule which uses a precondition to check for a defined imagePullSecret. If exists, perform an API lookup to get all Secrets in that Namespace. Use a deny rule to reject the Pod if there is no Secret in the Namespace with the same name as the one defined in the imagePullSecret field.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Miaoxiang-philips
Comment options

@chipzoller
Comment options

Answer selected by Miaoxiang-philips
@Miaoxiang-philips
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #782 on October 17, 2023 11:55.