Creating policies for Kubernetes clusters
Use cluster policies to manage images and resources for Kubernetes clusters. Cluster policies are available only when Cloud Workloads is configured and the Tanium Client images are deployed to the targeted cluster.
Create an Allow External Services by IP policy
Use Allow External Services by IP policies to allow external services that have any of the specified IP addresses.
- From the Main menu, go to Modules > Enforce > Policy Configurations > Create.
- Click Select Types.
- Select Kubernetes as the Platform for the endpoints that you want to target with the policies.
- Select Allow External Services by IP as the policy type.
Note: Only Windows policies can include more than one policy type.
- Click Confirm.
- In the Summary section, provide the identifying details for the policy.
- Enter a Name and optional Description for the policy.
- If you do not want to use the default content set for the policy, select a Content Set.
Every policy requires a content set. The content set is configured by default to the platform for the selected policy types, provided that you have the necessary permissions for that content set. If no content set is available, you might need additional permissions. For more information, see Managing access to content through content sets.
- On the Rules tab, review the default rule, which specifies the resources to evaluate with the policy, and update it if needed.
-
(Optional) Click Add Rule to add rules to specify additional resources to evaluate with the policy.
Note: The Resource Types, API Groups, and API Versions rules can be modified only for Block Resources by Version and Custom OPA policy types.
-
- On the Object Labels tab, review the default rules, which specify the labels to evaluate with the policy. Only objects that match the specified label selectors are evaluated by this policy. The default Object Labels rules cannot be modified.
-
(Optional) Click Add Label to add additional labels to evaluate with the policy. Specify the Key, Operator, and Value for the label.
For more information about object labels in Kubernetes, see Kubernetes Documentation: Labels and Selectors.
-
- On the Namespace Labels tab, review the default rules, which specify the namespace labels to evaluate with the policy. Only objects in namespaces that match the specified label selectors are evaluated by this policy. The default Namespace Labels rules cannot be modified.
-
(Optional) Click Add Label to add additional namespace labels to evaluate with the policy. Specify the Key, Operator, and Value for the label.
For more information about namespaces in Kubernetes, see Kubernetes Documentation: Namespaces.
-
- On the Configuration tab, provide the configuration details for the policy:
- Select a Mode:
-
Dry Run: Logs the results that the policy would have in the Event History of the enforcement details page, but does not enforce the policy.
-
Enforce: Enforces the policy on targets in a given enforcement.
-
- Select a Failure Policy:
-
Fail Closed: If the Tanium Admission Controller fails to evaluate a request for this policy, deny the request.
-
Fail Open: If the Tanium Admission Controller fails to evaluate a request for this policy, allow the request.
-
- In the Allowed External IP Addresses section, select the IP addresses to allow when creating service resources in Kubernetes.
- Select a Mode:
- Click Create.
Enforce the policy. For more information, see Enforcing policies.
Create an Allow Images by Registry policy
Use Allow Images by Registry policies to select specific registries that should be allowed for use in the cluster.
- From the Main menu, go to Modules > Enforce > Policy Configurations > Create.
- Click Select Types.
- Select Kubernetes as the Platform for the endpoints that you want to target with the policies.
- Select Allow Images by Registry as the policy type.
Note: Only Windows policies can include more than one policy type.
- Click Confirm.
- In the Summary section, provide the identifying details for the policy.
- Enter a Name and optional Description for the policy.
- If you do not want to use the default content set for the policy, select a Content Set.
Every policy requires a content set. The content set is configured by default to the platform for the selected policy types, provided that you have the necessary permissions for that content set. If no content set is available, you might need additional permissions. For more information, see Managing access to content through content sets.
- On the Rules tab, review the default rule, which specifies the resources to evaluate with the policy, and update it if needed.
-
(Optional) Click Add Rule to add rules to specify additional resources to evaluate with the policy.
Note: The Resource Types, API Groups, and API Versions rules can be modified only for Block Resources by Version and Custom OPA policy types.
-
- On the Object Labels tab, review the default rules, which specify the labels to evaluate with the policy. Only objects that match the specified label selectors are evaluated by this policy. The default Object Labels rules cannot be modified.
-
(Optional) Click Add Label to add additional labels to evaluate with the policy. Specify the Key, Operator, and Value for the label.
For more information about object labels in Kubernetes, see Kubernetes Documentation: Labels and Selectors.
-
- On the Namespace Labels tab, review the default rules, which specify the namespace labels to evaluate with the policy. Only objects in namespaces that match the specified label selectors are evaluated by this policy. The default Namespace Labels rules cannot be modified.
-
(Optional) Click Add Label to add additional namespace labels to evaluate with the policy. Specify the Key, Operator, and Value for the label.
For more information about namespaces in Kubernetes, see Kubernetes Documentation: Namespaces.
-
- On the Configuration tab, provide the configuration details for the policy:
- Select a Mode:
-
Dry Run: Logs the results that the policy would have in the Event History of the enforcement details page, but does not enforce the policy.
-
Enforce: Enforces the policy on targets in a given enforcement.
-
- Select a Failure Policy:
-
Fail Closed: If the Tanium Admission Controller fails to evaluate a request for this policy, deny the request.
-
Fail Open: If the Tanium Admission Controller fails to evaluate a request for this policy, allow the request.
-
- In the Image Registries section, select an existing image registry or add a new image registry to allow.
- (Optional) Select Always Pull Image to set imagePullPolicy=Always. This setting forces Kubernetes to compare the manifest of a local image to its remote counterpart to ensure a possibly manipulated local image does not imitate the trusted remote image. This option is enabled by default.
- Select a Mode:
- Click Create.
Enforce the policy. For more information, see Enforcing policies.
Create an Allow Ingress Actions by Hostname policy
Use Allow ingress actions by Hostname policies to specify the hostnames that are allowed when creating ingress resources in the cluster.
- From the Main menu, go to Modules > Enforce > Policy Configurations > Create.
- Click Select Types.
- Select Kubernetes as the Platform for the endpoints that you want to target with the policies.
- Select Allow Ingress Actions by Hostname as the policy type.
Note: Only Windows policies can include more than one policy type.
- In the Summary section, provide the identifying details for the policy.
- Enter a Name and optional Description for the policy.
- If you do not want to use the default content set for the policy, select a Content Set.
Every policy requires a content set. The content set is configured by default to the platform for the selected policy types, provided that you have the necessary permissions for that content set. If no content set is available, you might need additional permissions. For more information, see Managing access to content through content sets.
- On the Rules tab, review the default rule, which specifies the resources to evaluate with the policy, and update it if needed.
-
(Optional) Click Add Rule to add rules to specify additional resources to evaluate with the policy.
Note: The Resource Types, API Groups, and API Versions rules can be modified only for Block Resources by Version and Custom OPA policy types.
-
- On the Object Labels tab, review the default rules, which specify the labels to evaluate with the policy. Only objects that match the specified label selectors are evaluated by this policy. The default Object Labels rules cannot be modified.
-
(Optional) Click Add Label to add additional labels to evaluate with the policy. Specify the Key, Operator, and Value for the label.
For more information about object labels in Kubernetes, see Kubernetes Documentation: Labels and Selectors.
-
- On the Namespace Labels tab, review the default rules, which specify the namespace labels to evaluate with the policy. Only objects in namespaces that match the specified label selectors are evaluated by this policy. The default Namespace Labels rules cannot be modified.
-
(Optional) Click Add Label to add additional namespace labels to evaluate with the policy. Specify the Key, Operator, and Value for the label.
For more information about namespaces in Kubernetes, see Kubernetes Documentation: Namespaces.
-
- On the Configuration tab, provide the configuration details for the policy:
- Select a Mode:
-
Dry Run: Logs the results that the policy would have in the Event History of the enforcement details page, but does not enforce the policy.
-
Enforce: Enforces the policy on targets in a given enforcement.
-
- Select a Failure Policy:
-
Fail Closed: If the Tanium Admission Controller fails to evaluate a request for this policy, deny the request.
-
Fail Open: If the Tanium Admission Controller fails to evaluate a request for this policy, allow the request.
-
- In the Allowed Ingress Hostnames section, specify the hostnames allowed when creating ingress resources in Kubernetes.
- Select a Mode:
- Click Create.
Enforce the policy. For more information, see Enforcing policies.
Create a Block Images by Registry policy
Use Block Images by Registry policies to block images that are included in the set of selected registries.
- From the Main menu, go to Modules > Enforce > Policy Configurations > Create.
- Click Select Types.
- Select Kubernetes as the Platform for the endpoints that you want to target with the policies.
- Select Block Images by Registry policy as the policy type.
Note: Only Windows policies can include more than one policy type.
- Click Create.
- In the Summary section, provide the identifying details for the policy.
- Enter a Name and optional Description for the policy.
- If you do not want to use the default content set for the policy, select a Content Set.
Every policy requires a content set. The content set is configured by default to the platform for the selected policy types, provided that you have the necessary permissions for that content set. If no content set is available, you might need additional permissions. For more information, see Managing access to content through content sets.
- On the Rules tab, review the default rule, which specifies the resources to evaluate with the policy, and update it if needed.
-
(Optional) Click Add Rule to add rules to specify additional resources to evaluate with the policy.
Note: The Resource Types, API Groups, and API Versions rules can be modified only for Block Resources by Version and Custom OPA policy types.
-
- On the Object Labels tab, review the default rules, which specify the labels to evaluate with the policy. Only objects that match the specified label selectors are evaluated by this policy. The default Object Labels rules cannot be modified.
-
(Optional) Click Add Label to add additional labels to evaluate with the policy. Specify the Key, Operator, and Value for the label.
For more information about object labels in Kubernetes, see Kubernetes Documentation: Labels and Selectors.
-
- On the Namespace Labels tab, review the default rules, which specify the namespace labels to evaluate with the policy. Only objects in namespaces that match the specified label selectors are evaluated by this policy. The default Namespace Labels rules cannot be modified.
-
(Optional) Click Add Label to add additional namespace labels to evaluate with the policy. Specify the Key, Operator, and Value for the label.
For more information about namespaces in Kubernetes, see Kubernetes Documentation: Namespaces.
-
- On the Configuration tab, provide the configuration details for the policy:
- Select a Mode:
-
Dry Run: Logs the results that the policy would have in the Event History of the enforcement details page, but does not enforce the policy.
-
Enforce: Enforces the policy on targets in a given enforcement.
-
- Select a Failure Policy:
-
Fail Closed: If the Tanium Admission Controller fails to evaluate a request for this policy, deny the request.
-
Fail Open: If the Tanium Admission Controller fails to evaluate a request for this policy, allow the request.
-
- In the Image Registries section, select an existing image registry or add a new image registry to block.
- (Optional) Select Always Pull Image to set imagePullPolicy=Always. This setting forces Kubernetes to compare the manifest of a local image to its remote counterpart to ensure a possibly manipulated local image does not imitate the trusted remote image. This option is enabled by default.
- Select a Mode:
- Click Create.
Enforce the policy. For more information, see Enforcing policies.
Create a Block Images by Tag policy
Use Block Images by Tag policies to block any images that have any of the specified image tags.
- From the Main menu, go to Modules > Enforce > Policy Configurations > Create.
- Click Select Types.
- Select Kubernetes as the Platform for the endpoints that you want to target with the policies.
- Select Block Images by Tag as the policy type.
Note: Only Windows policies can include more than one policy type.
- Click Confirm.
- In the Summary section, provide the identifying details for the policy.
- Enter a Name and optional Description for the policy.
- If you do not want to use the default content set for the policy, select a Content Set.
Every policy requires a content set. The content set is configured by default to the platform for the selected policy types, provided that you have the necessary permissions for that content set. If no content set is available, you might need additional permissions. For more information, see Managing access to content through content sets.
- On the Rules tab, review the default rule, which specifies the resources to evaluate with the policy, and update it if needed.
-
(Optional) Click Add Rule to add rules to specify additional resources to evaluate with the policy.
Note: The Resource Types, API Groups, and API Versions rules can be modified only for Block Resources by Version and Custom OPA policy types.
-
- On the Object Labels tab, review the default rules, which specify the labels to evaluate with the policy. Only objects that match the specified label selectors are evaluated by this policy. The default Object Labels rules cannot be modified.
-
(Optional) Click Add Label to add additional labels to evaluate with the policy. Specify the Key, Operator, and Value for the label.
For more information about object labels in Kubernetes, see Kubernetes Documentation: Labels and Selectors.
-
- On the Namespace Labels tab, review the default rules, which specify the namespace labels to evaluate with the policy. Only objects in namespaces that match the specified label selectors are evaluated by this policy. The default Namespace Labels rules cannot be modified.
-
(Optional) Click Add Label to add additional namespace labels to evaluate with the policy. Specify the Key, Operator, and Value for the label.
For more information about namespaces in Kubernetes, see Kubernetes Documentation: Namespaces.
-
- On the Configuration tab, provide the configuration details for the policy:
- Select a Mode:
-
Dry Run: Logs the results that the policy would have in the Event History of the enforcement details page, but does not enforce the policy.
-
Enforce: Enforces the policy on targets in a given enforcement.
-
- Select a Failure Policy:
-
Fail Closed: If the Tanium Admission Controller fails to evaluate a request for this policy, deny the request.
-
Fail Open: If the Tanium Admission Controller fails to evaluate a request for this policy, allow the request.
-
- In the Image Tags section, select an existing tag or add a new tag to block.
- (Optional) Select Always Pull Image to set imagePullPolicy=Always. This setting forces Kubernetes to compare the manifest of a local image to its remote counterpart to ensure a possibly manipulated local image does not imitate the trusted remote image. This option is enabled by default.
- Select a Mode:
- Click Create.
Enforce the policy. For more information, see Enforcing policies.
Create a Block Resources by Version policy
Use Block Resources by Version policies to block the creation of out of date APIs.
- From the Main menu, go to Modules > Enforce > Policy Configurations > Create.
- Click Select Types.
- Select Kubernetes as the Platform for the endpoints that you want to target with the policies.
- Select Block Resources by Version as the policy type.
Note: Only Windows policies can include more than one policy type.
- In the Summary section, provide the identifying details for the policy.
- Enter a Name and optional Description for the policy.
- If you do not want to use the default content set for the policy, select a Content Set.
Every policy requires a content set. The content set is configured by default to the platform for the selected policy types, provided that you have the necessary permissions for that content set. If no content set is available, you might need additional permissions. For more information, see Managing access to content through content sets.
- On the Rules tab, review the default rule, which specifies the resources to evaluate with the policy, and update it if needed.
-
(Optional) Click Add Rule to add rules to specify additional parameters to evaluate with the policy. Specify the details for the rule:
-
Operations: Select Kubernetes operations to evaluate the policy against.
-
Resources Types: Select the Kubernetes resource types to evaluate the policy against.
-
API Groups: Specify the API groups to evaluate with this policy.
-
API Versions: Specify the Kubernetes API versions to block.
-
-
- On the Object Labels tab, review the default rules, which specify the labels to evaluate with the policy. Only objects that match the specified label selectors are evaluated by this policy. The default Object Labels rules cannot be modified.
-
(Optional) Click Add Label to add additional labels to evaluate with the policy. Specify the Key, Operator, and Value for the label.
For more information about object labels in Kubernetes, see Kubernetes Documentation: Labels and Selectors.
-
- On the Namespace Labels tab, review the default rules, which specify the namespace labels to evaluate with the policy. Only objects in namespaces that match the specified label selectors are evaluated by this policy. The default Namespace Labels rules cannot be modified.
-
(Optional) Click Add Label to add additional namespace labels to evaluate with the policy. Specify the Key, Operator, and Value for the label.
For more information about namespaces in Kubernetes, see Kubernetes Documentation: Namespaces.
-
- On the Configuration tab, provide the configuration details for the policy:
- Select a Mode:
-
Dry Run: Logs the results that the policy would have in the Event History of the enforcement details page, but does not enforce the policy.
-
Enforce: Enforces the policy on targets in a given enforcement.
-
- Select a Failure Policy:
-
Fail Closed: If the Tanium Admission Controller fails to evaluate a request for this policy, deny the request.
-
Fail Open: If the Tanium Admission Controller fails to evaluate a request for this policy, allow the request.
-
- Select a Mode:
- Click Create.
Enforce the policy. For more information, see Enforcing policies.
Create a Block Rogue Containers policy
Use Block Rogue Containers policies to block any images that are not from the list of trusted registries configured in Cloud Workloads.
- From the Main menu, go to Modules > Enforce > Policy Configurations > Create.
- Click Select Types.
- Select Kubernetes as the Platform for the endpoints that you want to target with the policies.
- Select Block Rogue Containers as the policy type.
Note: Only Windows policies can include more than one policy type.
- Click Confirm.
- In the Summary section, provide the identifying details for the policy.
- Enter a Name and optional Description for the policy.
- If you do not want to use the default content set for the policy, select a Content Set.
Every policy requires a content set. The content set is configured by default to the platform for the selected policy types, provided that you have the necessary permissions for that content set. If no content set is available, you might need additional permissions. For more information, see Managing access to content through content sets.
- On the Rules tab, review the default rule, which specifies the resources to evaluate with the policy, and update it if needed.
-
(Optional) Click Add Rule to add rules to specify additional resources to evaluate with the policy.
Note: The Resource Types, API Groups, and API Versions rules can be modified only for Block Resources by Version and Custom OPA policy types.
-
- On the Object Labels tab, review the default rules, which specify the labels to evaluate with the policy. Only objects that match the specified label selectors are evaluated by this policy. The default Object Labels rules cannot be modified.
-
(Optional) Click Add Label to add additional labels to evaluate with the policy. Specify the Key, Operator, and Value for the label.
For more information about object labels in Kubernetes, see Kubernetes Documentation: Labels and Selectors.
-
- On the Namespace Labels tab, review the default rules, which specify the namespace labels to evaluate with the policy. Only objects in namespaces that match the specified label selectors are evaluated by this policy. The default Namespace Labels rules cannot be modified.
-
(Optional) Click Add Label to add additional namespace labels to evaluate with the policy. Specify the Key, Operator, and Value for the label.
For more information about namespaces in Kubernetes, see Kubernetes Documentation: Namespaces.
-
- On the Configuration tab, provide the configuration details for the policy:
- Select a Mode:
-
Dry Run: Logs the results that the policy would have in the Event History of the enforcement details page, but does not enforce the policy.
-
Enforce: Enforces the policy on targets in a given enforcement.
-
- Select a Failure Policy:
-
Fail Closed: If the Tanium Admission Controller fails to evaluate a request for this policy, deny the request.
-
Fail Open: If the Tanium Admission Controller fails to evaluate a request for this policy, allow the request.
-
- (Optional) Select Always Pull Image to set imagePullPolicy=Always. This setting forces Kubernetes to compare the manifest of a local image to its remote counterpart to ensure a possibly manipulated local image does not imitate the trusted remote image. This option is enabled by default.
- Select a Mode:
- Click Create.
Enforce the policy. For more information, see Enforcing policies.
Create a Custom OPA policy
Use Custom OPA policies to provide a block of Rego code to configure custom Open Policy Agent (OPA) policies.
- From the Main menu, go to Modules > Enforce > Policy Configurations > Create.
- Click Select Types.
- Select Kubernetes as the Platform for the endpoints that you want to target with the policies.
- Select Custom OPA policy as the policy type.
Note: Only Windows policies can include more than one policy type.
- In the Summary section, provide the identifying details for the policy.
- Enter a Name and optional Description for the policy.
- If you do not want to use the default content set for the policy, select a Content Set.
Every policy requires a content set. The content set is configured by default to the platform for the selected policy types, provided that you have the necessary permissions for that content set. If no content set is available, you might need additional permissions. For more information, see Managing access to content through content sets.
- On the Rules tab, review the default rule, which specifies the resources to evaluate with the policy, and update it if needed.
-
(Optional) Click Add Rule to add rules to specify additional parameters to evaluate with the policy. Specify the details for the rule:
-
Resources Types: Select the Kubernetes resource types to evaluate the policy against.
-
API Groups: Specify the API groups to evaluate with this policy.
-
API Versions: Specify the Kubernetes API versions to block.
Note: The Operations rules can be modified only for Block Resources by Version policy types. -
-
- On the Object Labels tab, review the default rules, which specify the labels to evaluate with the policy. Only objects that match the specified label selectors are evaluated by this policy. The default Object Labels rules cannot be modified.
-
(Optional) Click Add Label to add additional labels to evaluate with the policy. Specify the Key, Operator, and Value for the label.
For more information about object labels in Kubernetes, see Kubernetes Documentation: Labels and Selectors.
-
- On the Namespace Labels tab, review the default rules, which specify the namespace labels to evaluate with the policy. Only objects in namespaces that match the specified label selectors are evaluated by this policy. The default Namespace Labels rules cannot be modified.
-
(Optional) Click Add Label to add additional namespace labels to evaluate with the policy. Specify the Key, Operator, and Value for the label.
For more information about namespaces in Kubernetes, see Kubernetes Documentation: Namespaces.
-
- On the Configuration tab, provide the configuration details for the policy:
- Select a Mode:
-
Dry Run: Logs the results that the policy would have in the Event History of the enforcement details page, but does not enforce the policy.
-
Enforce: Enforces the policy on targets in a given enforcement.
-
- Select a Failure Policy:
-
Fail Closed: If the Tanium Admission Controller fails to evaluate a request for this policy, deny the request.
-
Fail Open: If the Tanium Admission Controller fails to evaluate a request for this policy, allow the request.
-
- In the Rego Policy section, provide the Rego code for the policy.
Note: Click Copy Template to copy an example policy and modify the policy for your environment:
-
Package: The policy package must be named tanium.
-
Expressions: The policy must include a single expression, named deny, that consists of a list of strings that represent the reasons for which the request is denied. To allow a request, set deny to an empty list.
-
Input: Use input.request to reference the input to the policy, where request is the admission request received by the Kubernetes admissions controller.
-
- Select a Mode:
- Click Create.
Enforce the policy. For more information, see Enforcing policies.