Define the registries from which images can be pulled for deployment in your managed namespaces on Tanzu Platform for Kubernetes. You can make the deployments to namespaces in your clusters more secure by restricting the image registries from which images can be pulled, as well as the images that can be pulled from a registry.
By default, Tanzu Platform for Kubernetes does not impose any such restriction, and allows you to manage image registry restrictions for projects, cluster groups, and clusters.
To create an image registry policy for an object, you must be associated with the .admin
role for that object.
To confirm you have the correct permissions:
Do the following to create an image policy in your project in Tanzu Platform hub:
Provide a policy name.
The Scope and Object name is auto generated based on the object you selected in the tree. Provide any of the following parameters:
Make sure you click Add Rule for each rule that you define.
Select the Enforcement action you want the policy to use.
Enforcement action | Description |
---|---|
Deny (default) | The policy is fully enforced. Requests that violate the policy are denied admission. |
Dry run | The policy is not enforced. However, you can see the impact of the policy for testing. If this option is selected, the policy does not prevent containers from being scheduled on the cluster, but you do receive alerts for policy violations. You can later edit this policy to re-enable policy enforcement. |
Warn | Similar to Dry run, except that it provides immediate feedback when a potential denial occurs. |
(Optional) Provide label selectors to specify particular namespaces that you want to include or exclude for this policy.
Click Create Policy.
The policy is applied to the object and displayed on the Policies page.