Create a Kubernetes security policy

Define a policy by specifying security constraints for Kubernetes clusters.

To create a Kubernetes security policy, in the menu, expand Environment related, select Policies, and then choose Create policy. From the list, select Kubernetes Security and select Continue to begin configuring the policy.

Field/Option
Overview

Name

Define a name for this policy.

Environment groups

Select one or more Kubernetes environment groups from the dropdown menu.

Restrict access to the default namespace

When this option is enabled, the default namespace behaves like any other standard namespace. Access is restricted to admin users and to users who have been explicitly granted permission.

Restrict secret contents access for non-admins (UI only)

By default, users are able to view and edit Kubernetes secrets within the Portainer UI. Enabling this option disallows all non-admin users from doing so. Note that due to limitations within Kubernetes itself this only applies to the Portainer UI and does not prevent users from doing so through the command line or API.

Enable pod security constraints

Pod security constraints can be used to define under what conditions workloads can run. To set these constraints, toggle this option on, then toggle and configure the features you require. More information on each pod security constraint option can be found in the Kubernetes security constraints documentation.

When you have completed the form, click Create policy.

Last updated

Was this helpful?