mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-09-14 13:04:31 +00:00
Merge pull request #1884 from rancher/main
Sync v2.12.0 branch with main
This commit is contained in:
-3
@@ -199,7 +199,6 @@ Because `rancher` is the default option for `ingress.tls.source`, we are not spe
|
||||
- Set the `hostname` to the DNS name you pointed at your load balancer.
|
||||
- Set the `bootstrapPassword` to something unique for the `admin` user.
|
||||
- To install a specific Rancher version, use the `--version` flag, example: `--version 2.7.0`
|
||||
- For Kubernetes v1.25 or later, set `global.cattle.psp.enabled` to `false` when using Rancher v2.7.2-v2.7.4. This is not necessary for Rancher v2.7.5 and above, but you can still manually set the option if you choose.
|
||||
|
||||
```
|
||||
helm install rancher rancher-<CHART_REPO>/rancher \
|
||||
@@ -240,7 +239,6 @@ In the following command,
|
||||
- `ingress.tls.source` is set to `letsEncrypt`
|
||||
- `letsEncrypt.email` is set to the email address used for communication about your certificate (for example, expiry notices)
|
||||
- Set `letsEncrypt.ingress.class` to whatever your ingress controller is, e.g., `traefik`, `nginx`, `haproxy`, etc.
|
||||
- For Kubernetes v1.25 or later, set `global.cattle.psp.enabled` to `false` when using Rancher v2.7.2-v2.7.4. This is not necessary for Rancher v2.7.5 and above, but you can still manually set the option if you choose.
|
||||
|
||||
:::warning
|
||||
|
||||
@@ -289,7 +287,6 @@ If you want to check if your certificates are correct, see [How do I check Commo
|
||||
- Set the `hostname`.
|
||||
- Set the `bootstrapPassword` to something unique for the `admin` user.
|
||||
- Set `ingress.tls.source` to `secret`.
|
||||
- For Kubernetes v1.25 or later, set `global.cattle.psp.enabled` to `false` when using Rancher v2.7.2-v2.7.4. This is not necessary for Rancher v2.7.5 and above, but you can still manually set the option if you choose.
|
||||
|
||||
```
|
||||
helm install rancher rancher-<CHART_REPO>/rancher \
|
||||
|
||||
-72
@@ -1,72 +0,0 @@
|
||||
---
|
||||
title: Upgrading a Hardened Custom/Imported Cluster to Kubernetes v1.25
|
||||
---
|
||||
|
||||
<head>
|
||||
<link rel="canonical" href="https://ranchermanager.docs.rancher.com/getting-started/installation-and-upgrade/install-upgrade-on-a-kubernetes-cluster/upgrade-a-hardened-cluster-to-k8s-v1-25"/>
|
||||
</head>
|
||||
|
||||
Kubernetes v1.25 changes how clusters describe and implement security policies. From this version forward, [Pod Security Policies (PSPs)](https://kubernetes.io/docs/concepts/security/pod-security-policy/) are no longer available. Kubernetes v1.25 replaces them with new security objects: [Pod Security Standards (PSS)](https://kubernetes.io/docs/concepts/security/pod-security-standards/), and [Pod Security Admissions (PSAs)](https://kubernetes.io/docs/concepts/security/pod-security-admission/).
|
||||
|
||||
If you have custom or imported hardened clusters, you must take special preparations to ensure that the upgrade from an earlier version of Kubernetes to v1.25 or later goes smoothly.
|
||||
|
||||
:::note
|
||||
|
||||
After you upgrade to v1.25, add the necessary Rancher namespace exemptions. See [Pod Security Admission (PSA) Configuration Templates](../../../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/psa-config-templates.md#exempting-required-rancher-namespaces) for more details.
|
||||
|
||||
:::
|
||||
|
||||
## Upgrading Imported Hardened Clusters to Kubernetes v1.25 or Later
|
||||
|
||||
<Tabs groupId="k8s-distro">
|
||||
<TabItem value="RKE2" default>
|
||||
|
||||
Perform the following on each node in the cluster:
|
||||
1. Save [`rancher-psact.yaml`](./rancher-psact.yaml) in `/etc/rancher/rke2`.
|
||||
1. Edit the RKE2 configuration file:
|
||||
1. Update the `profile` field to `cis-1.23`.
|
||||
1. Specify the path for the configuration file that you just added: `pod-security-admission-config-file: /etc/rancher/rke2/rancher-psact.yaml`.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="K3s">
|
||||
|
||||
Perform the following on each node in the cluster:
|
||||
|
||||
Follow the official K3s instructions on [Upgrading Hardened Clusters from v1.24.x to v1.25.x](https://docs.k3s.io/known-issues#hardened-125), but use a [custom](./rancher-psact.yaml) Rancher PSA configuration template, instead of the configuration provided on the official K3s site.
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
After you perform these steps, you can upgrade the cluster's Kubernetes version through the Rancher UI:
|
||||
|
||||
1. In the upper left corner, click **☰ > Cluster Management**.
|
||||
1. Find the cluster you want to update in the **Clusters** table, and click the **⋮**.
|
||||
1. Select **Edit Config**.
|
||||
1. In the **Kubernetes Version** dropdown menu, select the version that you would like to use.
|
||||
1. Click **Save**.
|
||||
|
||||
## Upgrading Custom Hardened Clusters to Kubernetes v1.25 or Later
|
||||
|
||||
<Tabs groupId="k8s-distro">
|
||||
<TabItem value="RKE2" default>
|
||||
|
||||
1. In the upper left corner, click **☰ > Cluster Management**.
|
||||
1. Find the cluster you want to update in the **Clusters** table, and click the **⋮**.
|
||||
1. Select **Edit Config**.
|
||||
1. Under **Basics > Security**, in the **CIS Profile** dropdown menu, select `cis-1.23`.
|
||||
1. In the **Pod Security Admission Configuration Template** dropdown menu, select `rancher-restricted`.
|
||||
1. In the **Kubernetes Version** dropdown menu, select the version that you would like to use.
|
||||
1. Click **Save**.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="K3s">
|
||||
|
||||
1. In the upper left corner, click **☰ > Cluster Management**.
|
||||
1. Find the cluster you want to update in the **Clusters** table, and click the **⋮**.
|
||||
1. Select **Edit YAML**.
|
||||
1. Delete `PodSecurityPolicy` from `kube-apiserver-arg.enable-admission-plugins`
|
||||
1. Add this line to the `spec` field: `defaultPodSecurityAdmissionConfigurationTemplateName: rancher-restricted`
|
||||
1. Update `kubernetesVersion` to your chosen version (v1.25 or later).
|
||||
1. Click **Save**.
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
-4
@@ -152,8 +152,6 @@ Upgrade Rancher to the latest version with all your settings.
|
||||
|
||||
Take all the values from the previous step and append them to the command using `--set key=value`.
|
||||
|
||||
For Kubernetes v1.25 or later, set `global.cattle.psp.enabled` to `false` when using Rancher v2.7.2-v2.7.4. This is not necessary for Rancher v2.7.5 and above, but you can still manually set the option if you choose.
|
||||
|
||||
```
|
||||
helm upgrade rancher rancher-<CHART_REPO>/rancher \
|
||||
--namespace cattle-system \
|
||||
@@ -186,8 +184,6 @@ Alternatively, it's possible to export the current values to a file and referenc
|
||||
```
|
||||
1. Update only the Rancher version:
|
||||
|
||||
For Kubernetes v1.25 or later, set `global.cattle.psp.enabled` to `false` when using Rancher v2.7.2-v2.7.4. This is not necessary for Rancher v2.7.5 and above, but you can still manually set the option if you choose.
|
||||
|
||||
```
|
||||
helm upgrade rancher rancher-<CHART_REPO>/rancher \
|
||||
--namespace cattle-system \
|
||||
|
||||
-2
@@ -62,8 +62,6 @@ For information on enabling experimental features, refer to [this page.](../../.
|
||||
| `systemDefaultRegistry` | "" | `string` - private registry to be used for all system container images, e.g., http://registry.example.com/ |
|
||||
| `tls` | "ingress" | `string` - See [External TLS Termination](#external-tls-termination) for details. - "ingress, external" |
|
||||
| `useBundledSystemChart` | `false` | `bool` - select to use the system-charts packaged with Rancher server. This option is used for air gapped installations. |
|
||||
| `global.cattle.psp.enabled` | `true` | `bool` - select 'false' to disable PSPs for Kubernetes v1.25 and above when using Rancher v2.7.2-v2.7.4. When using Rancher v2.7.5 and above, Rancher attempts to detect if a cluster is running a Kubernetes version where PSPs are not supported, and will default it's usage of PSPs to false if it can determine that PSPs are not supported in the cluster. Users can still manually override this by explicitly providing `true` or `false` for this value. Rancher will still use PSPs by default in clusters which support PSPs (such as clusters running Kubernetes v1.24 or lower). |
|
||||
|
||||
|
||||
### Bootstrap Password
|
||||
|
||||
|
||||
-2
@@ -172,7 +172,6 @@ kubectl create namespace cattle-system
|
||||
|
||||
Next, install Rancher, declaring your chosen options. Use the reference table below to replace each placeholder. Rancher needs to be configured to use the private registry in order to provision any Rancher launched Kubernetes clusters or Rancher tools.
|
||||
|
||||
For Kubernetes v1.25 or later, set `global.cattle.psp.enabled` to `false` when using Rancher v2.7.2-v2.7.4. This is not necessary for Rancher v2.7.5 and above, but you can still manually set the option if you choose.
|
||||
|
||||
Placeholder | Description
|
||||
------------|-------------
|
||||
@@ -203,7 +202,6 @@ Create Kubernetes secrets from your own certificates for Rancher to use. The com
|
||||
|
||||
Install Rancher, declaring your chosen options. Use the reference table below to replace each placeholder. Rancher needs to be configured to use the private registry in order to provision any Rancher launched Kubernetes clusters or Rancher tools.
|
||||
|
||||
For Kubernetes v1.25 or later, set `global.cattle.psp.enabled` to `false` when using Rancher v2.7.2-v2.7.4. This is not necessary for Rancher v2.7.5 and above, but you can still manually set the option if you choose.
|
||||
|
||||
| Placeholder | Description |
|
||||
| -------------------------------- | ----------------------------------------------- |
|
||||
|
||||
@@ -35,7 +35,7 @@ The Rancher API server is built on top of an embedded Kubernetes API server and
|
||||
### Authorization and Role-Based Access Control
|
||||
|
||||
- **User management:** The Rancher API server [manages user identities](../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/authentication-config/authentication-config.md) that correspond to external authentication providers like Active Directory or GitHub, in addition to local users.
|
||||
- **Authorization:** The Rancher API server manages [access control](../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/manage-role-based-access-control-rbac/manage-role-based-access-control-rbac.md) and [security](../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md) policies.
|
||||
- **Authorization:** The Rancher API server manages [access control](../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/manage-role-based-access-control-rbac/manage-role-based-access-control-rbac.md) and [security](../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/pod-security-standards.md) standards.
|
||||
|
||||
### Working with Kubernetes
|
||||
|
||||
|
||||
@@ -128,7 +128,6 @@ The final command to install Rancher is below. The command requires a domain nam
|
||||
|
||||
To install a specific Rancher version, use the `--version` flag (e.g., `--version 2.6.6`). Otherwise, the latest Rancher is installed by default. Refer to [Choosing a Rancher Version](../../installation-and-upgrade/resources/choose-a-rancher-version.md).
|
||||
|
||||
For Kubernetes v1.25 or later, set `global.cattle.psp.enabled` to `false` when using Rancher v2.7.2-v2.7.4. This is not necessary for Rancher v2.7.5 and above, but you can still manually set the option if you choose.
|
||||
|
||||
See [Setting up the Bootstrap Password](../../installation-and-upgrade/resources/bootstrap-password.md#password-requirements) for password requirements.
|
||||
|
||||
|
||||
-6
@@ -13,9 +13,3 @@ title: Install Rancher CIS Benchmark
|
||||
1. Click **Install**.
|
||||
|
||||
**Result:** The CIS scan application is deployed on the Kubernetes cluster.
|
||||
|
||||
:::note
|
||||
|
||||
If you are running Kubernetes v1.24 or earlier, and have a [Pod Security Policy](../../new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md) (PSP) hardened cluster, CIS Benchmark 4.0.0 and later disable PSPs by default. To install CIS Benchmark on a PSP-hardened cluster, set `global.psp.enabled` to `true` in the values before installing the chart. [Pod Security Admission](../../new-user-guides/authentication-permissions-and-global-configuration/pod-security-standards.md) (PSA) hardened clusters aren't affected.
|
||||
|
||||
:::
|
||||
|
||||
-1
@@ -39,7 +39,6 @@ Values set from the Rancher API will override the value passed in through the co
|
||||
|
||||
When installing Rancher with a Helm chart, use the `--set` option. In the below example, two features are enabled by passing the feature flag names in a comma separated list:
|
||||
|
||||
For Kubernetes v1.25 or later, set `global.cattle.psp.enabled` to `false` when using Rancher v2.7.2-v2.7.4. This is not necessary for Rancher v2.7.5 and above, but you can still manually set the option if you choose.
|
||||
|
||||
```
|
||||
helm install rancher rancher-latest/rancher \
|
||||
|
||||
@@ -17,7 +17,6 @@ Detailed information can be found in [this announcement](https://forums.suse.com
|
||||
:::note Prerequisites:
|
||||
|
||||
- Only a user with the `cluster-admin` [Kubernetes default role](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles) assigned can configure and install Istio in a Kubernetes cluster.
|
||||
- If you have pod security policies, you will need to install Istio with the CNI enabled. For details, see [this section.](../../../integrations-in-rancher/istio/configuration-options/pod-security-policies.md)
|
||||
- To install Istio on an RKE2 cluster, additional steps are required. For details, see [this section.](../../../integrations-in-rancher/istio/configuration-options/install-istio-on-rke2-cluster.md)
|
||||
- To install Istio in a cluster where project network isolation is enabled, additional steps are required. For details, see [this section.](../../../integrations-in-rancher/istio/configuration-options/project-network-isolation.md)
|
||||
|
||||
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
---
|
||||
title: Applying Pod Security Policies to Projects
|
||||
---
|
||||
|
||||
<head>
|
||||
<link rel="canonical" href="https://ranchermanager.docs.rancher.com/how-to-guides/advanced-user-guides/manage-projects/manage-pod-security-policies"/>
|
||||
</head>
|
||||
|
||||
:::note
|
||||
|
||||
These cluster options are only available for [clusters in which Rancher has launched Kubernetes](../../new-user-guides/launch-kubernetes-with-rancher/launch-kubernetes-with-rancher.md).
|
||||
|
||||
:::
|
||||
|
||||
You can always assign a pod security policy (PSP) to an existing project if you didn't assign one during creation.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Create a Pod Security Policy within Rancher. Before you can assign a default PSP to an existing project, you must have a PSP available for assignment. For instruction, see [Creating Pod Security Policies](../../new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md).
|
||||
- Assign a default Pod Security Policy to the project's cluster. You can't assign a PSP to a project until one is already applied to the cluster. For more information, see [the documentation about adding a pod security policy to a cluster](../../new-user-guides/manage-clusters/add-a-pod-security-policy.md).
|
||||
|
||||
### Applying a Pod Security Policy
|
||||
|
||||
1. In the upper left corner, click **☰ > Cluster Management**.
|
||||
1. On the **Clusters** page, go to the cluster where you want to move a namespace and click **Explore**.
|
||||
1. Click **Cluster > Projects/Namespaces**.
|
||||
1. Find the project that you want to add a PSP to. From that project, select **⋮ > Edit Config**.
|
||||
1. From the **Pod Security Policy** drop-down, select the PSP you want to apply to the project.
|
||||
Assigning a PSP to a project will:
|
||||
|
||||
- Override the cluster's default PSP.
|
||||
- Apply the PSP to the project.
|
||||
- Apply the PSP to any namespaces you add to the project later.
|
||||
|
||||
1. Click **Save**.
|
||||
|
||||
**Result:** The PSP is applied to the project and any namespaces added to the project.
|
||||
|
||||
:::note
|
||||
|
||||
Any workloads that are already running in a cluster or project before a PSP is assigned will not be checked to determine if they comply with the PSP. Workloads would need to be cloned or upgraded to see if they pass the PSP.
|
||||
|
||||
:::
|
||||
@@ -24,7 +24,6 @@ You can use projects to perform actions like:
|
||||
- [Set resource quotas](manage-project-resource-quotas/manage-project-resource-quotas.md)
|
||||
- [Manage namespaces](../../new-user-guides/manage-namespaces.md)
|
||||
- [Configure tools](../../../reference-guides/rancher-project-tools.md)
|
||||
- [Configure pod security policies](manage-pod-security-policies.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
||||
-6
@@ -38,12 +38,6 @@ The user retention feature is disabled by default.
|
||||
|
||||
For more information, see [Enabling User Retention](../../advanced-user-guides/enable-user-retention.md).
|
||||
|
||||
## Pod Security Policies
|
||||
|
||||
_Pod Security Policies_ (or PSPs) are objects that control security-sensitive aspects of pod specification, e.g. root privileges. If a pod does not meet the conditions specified in the PSP, Kubernetes will not allow it to start, and Rancher will display an error message.
|
||||
|
||||
For more information how to create and use PSPs, see [Pod Security Policies](create-pod-security-policies.md).
|
||||
|
||||
## Provisioning Drivers
|
||||
|
||||
Drivers in Rancher allow you to manage which providers can be used to provision [hosted Kubernetes clusters](../kubernetes-clusters-in-rancher-setup/set-up-clusters-from-hosted-kubernetes-providers/set-up-clusters-from-hosted-kubernetes-providers.md) or [nodes in an infrastructure provider](../launch-kubernetes-with-rancher/use-new-nodes-in-an-infra-provider/use-new-nodes-in-an-infra-provider.md) to allow Rancher to deploy and manage Kubernetes.
|
||||
|
||||
-82
@@ -1,82 +0,0 @@
|
||||
---
|
||||
title: Creating Pod Security Policies
|
||||
---
|
||||
|
||||
<head>
|
||||
<link rel="canonical" href="https://ranchermanager.docs.rancher.com/how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies"/>
|
||||
</head>
|
||||
|
||||
:::caution
|
||||
Pod Security Policies are only available in Kubernetes until v1.24. [Pod Security Standards](pod-security-standards.md) are the built-in alternative.
|
||||
:::
|
||||
|
||||
[Pod Security Policies (PSPs)](https://kubernetes.io/docs/concepts/security/pod-security-policy/) are objects that control security-sensitive aspects of the pod specification (such as root privileges).
|
||||
|
||||
If a pod doesn't meet the conditions specified in the PSP, Kubernetes won't allow it to start, and Rancher will display the following error message: `Pod <NAME> is forbidden: unable to validate...`.
|
||||
|
||||
|
||||
## How PSPs Work
|
||||
|
||||
You can assign PSPs at the cluster or project level.
|
||||
|
||||
PSPs work through inheritance:
|
||||
|
||||
- By default, PSPs assigned to a cluster are inherited by its projects, as well as any namespaces added to those projects.
|
||||
- **Exception:** Namespaces that are not assigned to projects do not inherit PSPs, regardless of whether the PSP is assigned to a cluster or project. Because these namespaces have no PSPs, workload deployments to these namespaces will fail, which is the default Kubernetes behavior.
|
||||
- You can override the default PSP by assigning a different PSP directly to the project.
|
||||
|
||||
Any workloads that are already running in a cluster or project before a PSP is assigned will not be checked if it complies with the PSP. Workloads would need to be cloned or upgraded to see if they pass the PSP.
|
||||
|
||||
Read more about Pod Security Policies in the [Kubernetes documentation](https://kubernetes.io/docs/concepts/policy/pod-security-policy/).
|
||||
|
||||
## Default PSPs
|
||||
|
||||
Rancher ships with three default Pod Security Policies (PSPs): the `restricted-noroot`, `restricted` and `unrestricted` policies.
|
||||
|
||||
### Restricted-NoRoot
|
||||
|
||||
This policy is based on the Kubernetes [example restricted policy](https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/policy/restricted-psp.yaml). It significantly restricts what types of pods can be deployed to a cluster or project. This policy:
|
||||
|
||||
- Prevents pods from running as a privileged user and prevents escalation of privileges.
|
||||
- Validates that server-required security mechanisms are in place, such as restricting what volumes can be mounted to only the core volume types and preventing root supplemental groups from being added.
|
||||
|
||||
### Restricted
|
||||
|
||||
This policy is a relaxed version of the `restricted-noroot` policy, with almost all the restrictions in place, except for the fact that it allows running containers as a privileged user.
|
||||
|
||||
### Unrestricted
|
||||
|
||||
This policy is equivalent to running Kubernetes with the PSP controller disabled. It has no restrictions on what pods can be deployed into a cluster or project.
|
||||
|
||||
:::note important
|
||||
|
||||
When disabling PSPs, default PSPs are **not** automatically deleted from your cluster. You must manually delete them if they're no longer needed.
|
||||
|
||||
:::
|
||||
|
||||
## Creating PSPs
|
||||
|
||||
Using Rancher, you can create a Pod Security Policy using our GUI rather than creating a YAML file.
|
||||
|
||||
### Requirements
|
||||
|
||||
Rancher can only assign PSPs for clusters that are [launched using RKE](../launch-kubernetes-with-rancher/launch-kubernetes-with-rancher.md).
|
||||
|
||||
You must enable PSPs at the cluster level before you can assign them to a project. This can be configured by [editing the cluster](../../../reference-guides/cluster-configuration/cluster-configuration.md).
|
||||
|
||||
It is a best practice to set PSP at the cluster level.
|
||||
|
||||
We recommend adding PSPs during cluster and project creation instead of adding it to an existing one.
|
||||
|
||||
### Creating PSPs in the Rancher UI
|
||||
|
||||
1. In the upper left corner, click **☰ > Cluster Management**.
|
||||
1. In the left navigation bar, click **Pod Security Policies**.
|
||||
1. Click **Add Policy**.
|
||||
1. Name the policy.
|
||||
1. Complete each section of the form. Refer to the [Kubernetes documentation](https://kubernetes.io/docs/concepts/policy/pod-security-policy/) for more information on what each policy does.
|
||||
1. Click **Create**.
|
||||
|
||||
## Configuration
|
||||
|
||||
The Kubernetes documentation on PSPs is [here](https://kubernetes.io/docs/concepts/policy/pod-security-policy/).
|
||||
-57
@@ -11,54 +11,6 @@ They became available and were turned on by default in Kubernetes v1.23, and rep
|
||||
|
||||
PSS define security levels for workloads. PSAs describe requirements for pod security contexts and related fields. PSAs reference PSS levels to define security restrictions.
|
||||
|
||||
## Upgrade to Pod Security Standards (PSS)
|
||||
|
||||
Ensure that you migrate all PSPs to another workload security mechanism. This includes mapping your current PSPs to Pod Security Standards for enforcement with the [PSA controller](https://kubernetes.io/docs/concepts/security/pod-security-admission/). If the PSA controller won't meet all of your organization's needs, we recommend that you use a policy engine, such as [Kubewarden](https://www.kubewarden.io/), [Kyverno](https://kyverno.io/), or [NeuVector](https://neuvector.com/). Refer to the documentation of your policy engine of choice for more information on how to migrate from PSPs.
|
||||
|
||||
:::caution
|
||||
You must add your new policy enforcement mechanisms _before_ you remove the PodSecurityPolicy objects. If you don't, you may create an opportunity for privilege escalation attacks within the cluster.
|
||||
:::
|
||||
|
||||
### Removing PodSecurityPolicies from Rancher-Maintained Apps & Marketplace Workloads
|
||||
|
||||
Rancher v2.7.2 offers a new major version of Rancher-maintained Helm charts. v102.x.y allows you to remove PSPs that were installed with previous versions of the chart. This new version replaces non-standard PSPs switches with the standardized `global.cattle.psp.enabled` switch, which is turned off by default.
|
||||
|
||||
You must perform the following steps _while still in Kubernetes v1.24_:
|
||||
1. Configure the PSA controller to suit your needs. You can use one of Rancher's built-in [PSA Configuration Templates](#pod-security-admission-configuration-templates), or create a custom template and apply it to the clusters that you are migrating.
|
||||
|
||||
1. Map your active PSPs to Pod Security Standards:
|
||||
1. See which PSPs are still active in your cluster:
|
||||
:::caution
|
||||
This strategy may miss workloads that aren't currently running, such as CronJobs, workloads currently scaled to zero, or workloads that haven't rolled out yet.
|
||||
:::
|
||||
|
||||
```shell
|
||||
kubectl get pods \
|
||||
--all-namespaces \
|
||||
--output jsonpath='{.items[*].metadata.annotations.kubernetes\.io\/psp}' \
|
||||
| tr " " "\n" | sort -u
|
||||
```
|
||||
|
||||
1. Follow the Kubernetes guide on [Mapping PSPs to Pod Security Standards](https://kubernetes.io/docs/reference/access-authn-authz/psp-to-pod-security-standards/) to apply PSSs to your workloads that were relying on PSPs. See [Migrate from PodSecurityPolicy to the Built-In PodSecurity Admission controller](https://kubernetes.io/docs/tasks/configure-pod-container/migrate-from-psp/) for more details.
|
||||
|
||||
1. To remove PSPs from Rancher charts, upgrade the charts to the latest v102.x.y version _before_ you upgrade to Kubernetes v1.25. Make sure that the **Enable PodSecurityPolicies** option is **disabled**. This will remove any PSPs that were installed with previous chart versions.
|
||||
|
||||
:::info important
|
||||
If you want to upgrade your charts to v102.x.y, but don't plan on upgrading your clusters to Kubernetes v1.25 and moving away from PSPs, make sure that you select the option **Enable PodSecurityPolicies** for each chart that you are upgrading.
|
||||
:::
|
||||
|
||||
### Cleaning Up Releases After a Kubernetes v1.25 Upgrade
|
||||
|
||||
If you experience problems while removing PSPs from your charts, or have charts that don't contain a built-in mechanism for removing PSPs, your chart upgrades or deletions might fail with an error message such as the following:
|
||||
```console
|
||||
Error: UPGRADE FAILED: resource mapping not found for name: "<object-name>" namespace: "<object-namespace>" from "": no matches for kind "PodSecurityPolicy" in version "policy/v1beta1"
|
||||
ensure CRDs are installed first
|
||||
```
|
||||
|
||||
This happens when Helm tries to query the cluster for objects that were stored in a previous release's data blob. To clean up these releases and avoid this error, use the `helm-mapkubeapis` Helm plugin. To learn more about `helm-mapkubeapis`, how it works, and how it can be fine-tuned for your use case, see the [official Helm documentation](https://github.com/helm/helm-mapkubeapis#readme).
|
||||
|
||||
Note that Helm plugin installation is local to the machine that you run the commands from. Therefore, make sure that you run both the installation and cleanup from the same machine.
|
||||
|
||||
#### Install `helm-mapkubeapis`
|
||||
|
||||
1. Open your terminal in the machine you intend to use `helm-mapkubeapis` from and install the plugin:
|
||||
@@ -110,15 +62,6 @@ After you install the `helm-mapkubeapis` plugin, clean up the releases that beca
|
||||
|
||||
1. Finally, after reviewing the changes, perform a full run with `helm mapkubeapis <release-name> --namespace <release-namespace>`.
|
||||
|
||||
#### Upgrading Charts to a Version That Supports Kubernetes v1.25
|
||||
|
||||
You can proceed with your upgrade once any releases that had lingering PSPs are cleaned up. For Rancher-maintained workloads, follow the steps outlined in the [Removing PodSecurityPolicies from Rancher-maintained Apps & Marketplace workloads](#removing-podsecuritypolicies-from-rancher-maintained-apps--marketplace-workloads) section of this document.
|
||||
For workloads not maintained by Rancher, refer to the vendor documentation.
|
||||
|
||||
:::caution
|
||||
Do not skip this step. Applications incompatible with Kubernetes v1.25 aren't guaranteed to work after a cleanup.
|
||||
:::
|
||||
|
||||
## Pod Security Admission Configuration Templates
|
||||
|
||||
Rancher offers PSA configuration templates. These are pre-defined security configurations that you can apply to a cluster. Rancher admins (or those with the right permissions) can [create, manage, and edit](./psa-config-templates.md) PSA templates.
|
||||
|
||||
-1
@@ -168,7 +168,6 @@ Follow the steps to [install cert-manager](../../../getting-started/installation
|
||||
|
||||
Use the same version of Helm to install Rancher, that was used on the first cluster.
|
||||
|
||||
For Kubernetes v1.25 or later, set `global.cattle.psp.enabled` to `false` when using Rancher v2.7.2-v2.7.4. This is not necessary for Rancher v2.7.5 and above, but you can still manually set the option if you choose.
|
||||
|
||||
```bash
|
||||
helm install rancher rancher-latest/rancher \
|
||||
|
||||
+1
-10
@@ -269,15 +269,7 @@ Therefore, when Rancher registers a cluster, it assumes that several capabilitie
|
||||
|
||||
However, if the cluster has a certain capability, such as the ability to use a pod security policy, a user of that cluster might still want to select pod security policies for the cluster in the Rancher UI. In order to do that, the user will need to manually indicate to Rancher that pod security policies are enabled for the cluster.
|
||||
|
||||
By annotating a registered cluster, it is possible to indicate to Rancher that a cluster was given a pod security policy, or another capability, outside of Rancher.
|
||||
|
||||
This example annotation indicates that a pod security policy is enabled:
|
||||
|
||||
```json
|
||||
"capabilities.cattle.io/pspEnabled": "true"
|
||||
```
|
||||
|
||||
The following annotation indicates Ingress capabilities. Note that the values of non-primitive objects need to be JSON encoded, with quotations escaped.
|
||||
By annotating a registered cluster, it is possible to indicate to Rancher that a cluster was given Ingress capabilities, or another capability, outside of Rancher. The following annotation indicates Ingress capabilities. Note that the values of non-primitive objects need to be JSON encoded, with quotations escaped.
|
||||
|
||||
```json
|
||||
"capabilities.cattle.io/ingressCapabilities": "[
|
||||
@@ -294,7 +286,6 @@ These capabilities can be annotated for the cluster:
|
||||
- `loadBalancerCapabilities`
|
||||
- `nodePoolScalingSupported`
|
||||
- `nodePortRange`
|
||||
- `pspEnabled`
|
||||
- `taintSupport`
|
||||
|
||||
All the capabilities and their type definitions can be viewed in the Rancher API view, at `[Rancher Server URL]/v3/schemas/capabilities`.
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
---
|
||||
title: Adding a Pod Security Policy
|
||||
---
|
||||
|
||||
<head>
|
||||
<link rel="canonical" href="https://ranchermanager.docs.rancher.com/how-to-guides/new-user-guides/manage-clusters/add-a-pod-security-policy"/>
|
||||
</head>
|
||||
|
||||
:::note Prerequisite:
|
||||
|
||||
The options below are available only for clusters that are [launched using RKE.](../launch-kubernetes-with-rancher/launch-kubernetes-with-rancher.md)
|
||||
|
||||
:::
|
||||
|
||||
When your cluster is running pods with security-sensitive configurations, assign it a [pod security policy](../authentication-permissions-and-global-configuration/create-pod-security-policies.md), which is a set of rules that monitors the conditions and settings in your pods. If a pod doesn't meet the rules specified in your policy, the policy stops it from running.
|
||||
|
||||
You can assign a pod security policy when you provision a cluster. However, if you need to relax or restrict security for your pods later, you can update the policy while editing your cluster.
|
||||
|
||||
1. Click **☰ > Cluster Management**.
|
||||
1. Go to the cluster to which you want to apply a pod security policy and click **⋮ > Edit Config**.
|
||||
1. From **Pod Security Policy Support**, select **Enabled**.
|
||||
|
||||
:::note
|
||||
|
||||
This option is only available for clusters [provisioned by RKE](../launch-kubernetes-with-rancher/launch-kubernetes-with-rancher.md).
|
||||
|
||||
:::
|
||||
|
||||
4. From the **Default Pod Security Policy** drop-down, select the policy you want to apply to the cluster.
|
||||
|
||||
Rancher ships with [policies](../authentication-permissions-and-global-configuration/create-pod-security-policies.md#default-psps) of `restricted` and `unrestricted`, although you can [create custom policies](../authentication-permissions-and-global-configuration/create-pod-security-policies.md#creating-psps) as well.
|
||||
|
||||
5. Click **Save**.
|
||||
|
||||
**Result:** The pod security policy is applied to the cluster and any projects within the cluster.
|
||||
|
||||
:::note
|
||||
|
||||
Workloads already running before assignment of a pod security policy are grandfathered in. Even if they don't meet your pod security policy, workloads running before assignment of the policy continue to run.
|
||||
|
||||
To check if a running workload passes your pod security policy, clone or upgrade it.
|
||||
|
||||
:::
|
||||
@@ -1,29 +0,0 @@
|
||||
---
|
||||
title: Assigning Pod Security Policies
|
||||
---
|
||||
|
||||
<head>
|
||||
<link rel="canonical" href="https://ranchermanager.docs.rancher.com/how-to-guides/new-user-guides/manage-clusters/assign-pod-security-policies"/>
|
||||
</head>
|
||||
|
||||
_Pod Security Policies_ are objects that control security-sensitive aspects of pod specification (like root privileges).
|
||||
|
||||
## Adding a Default Pod Security Policy
|
||||
|
||||
When you create a new cluster with RKE, you can configure it to apply a PSP immediately. As you create the cluster, use the **Cluster Options** to enable a PSP. The PSP assigned to the cluster will be the default PSP for projects within the cluster.
|
||||
|
||||
:::note Prerequisite:
|
||||
|
||||
Create a Pod Security Policy within Rancher. Before you can assign a default PSP to a new cluster, you must have a PSP available for assignment. For instruction, see [Creating Pod Security Policies](../authentication-permissions-and-global-configuration/create-pod-security-policies.md).
|
||||
|
||||
:::
|
||||
|
||||
:::note
|
||||
|
||||
For security purposes, we recommend assigning a PSP as you create your clusters.
|
||||
|
||||
:::
|
||||
|
||||
To enable a default Pod Security Policy, set the **Pod Security Policy Support** option to **Enabled**, and then make a selection from the **Default Pod Security Policy** drop-down.
|
||||
|
||||
When the cluster finishes provisioning, the PSP you selected is applied to all projects within the cluster.
|
||||
@@ -126,12 +126,11 @@ Rancher extends Kubernetes to allow the application of [Pod Security Policies](h
|
||||
|
||||
This section describes how to create a new project with a name and with optional pod security policy, members, and resource quotas.
|
||||
|
||||
1. [Name a new project.](#1-name-a-new-project)
|
||||
2. [Optional: Select a pod security policy.](#2-optional-select-a-pod-security-policy)
|
||||
3. [Recommended: Add project members.](#3-recommended-add-project-members)
|
||||
4. [Optional: Add resource quotas.](#4-optional-add-resource-quotas)
|
||||
1. [Name a new project.](#name-a-new-project)
|
||||
1. [Recommended: Add project members.](#recommended-add-project-members)
|
||||
1. [Optional: Add resource quotas.](#optional-add-resource-quotas)
|
||||
|
||||
### 1. Name a New Project
|
||||
### Name a New Project
|
||||
|
||||
1. In the upper left corner, click **☰ > Cluster Management**.
|
||||
1. On the **Clusters** page, go to the cluster you want to project in and click **Explore**.
|
||||
@@ -139,17 +138,7 @@ This section describes how to create a new project with a name and with optional
|
||||
1. Click **Create Project**.
|
||||
1. Enter a **Project Name**.
|
||||
|
||||
### 2. Optional: Select a Pod Security Policy
|
||||
|
||||
This option is only available if you've already created a Pod Security Policy. For instruction, see [Creating Pod Security Policies](../authentication-permissions-and-global-configuration/create-pod-security-policies.md).
|
||||
|
||||
Assigning a PSP to a project will:
|
||||
|
||||
- Override the cluster's default PSP.
|
||||
- Apply the PSP to the project.
|
||||
- Apply the PSP to any namespaces you add to the project later.
|
||||
|
||||
### 3. Recommended: Add Project Members
|
||||
### Recommended: Add Project Members
|
||||
|
||||
Use the **Members** section to provide other users with project access and roles.
|
||||
|
||||
@@ -179,7 +168,7 @@ To add members:
|
||||
:::
|
||||
1. In the **Project Permissions** section, choose a role. For more information, refer to the [documentation on project roles.](../authentication-permissions-and-global-configuration/manage-role-based-access-control-rbac/cluster-and-project-roles.md)
|
||||
|
||||
### 4. Optional: Add Resource Quotas
|
||||
### Optional: Add Resource Quotas
|
||||
|
||||
Resource quotas limit the resources that a project (and its namespaces) can consume. For more information, see [Resource Quotas](../../advanced-user-guides/manage-projects/manage-project-resource-quotas/manage-project-resource-quotas.md).
|
||||
|
||||
|
||||
@@ -38,10 +38,6 @@ If you would like to limit Prometheus to specific namespaces, set `prometheus.pr
|
||||
|
||||
For details, refer to [this section.](selectors-and-scrape-configurations.md)
|
||||
|
||||
### Enable Istio with Pod Security Policies
|
||||
|
||||
Refer to [this section.](pod-security-policies.md)
|
||||
|
||||
### Additional Steps for Installing Istio on an RKE2 Cluster
|
||||
|
||||
Refer to [this section.](install-istio-on-rke2-cluster.md)
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
---
|
||||
title: Enable Istio with Pod Security Policies
|
||||
---
|
||||
|
||||
<head>
|
||||
<link rel="canonical" href="https://ranchermanager.docs.rancher.com/integrations-in-rancher/istio/configuration-options/pod-security-policies"/>
|
||||
</head>
|
||||
|
||||
:::warning
|
||||
|
||||
[Rancher-Istio](https://github.com/rancher/charts/tree/release-v2.11/charts/rancher-istio) will be deprecated in Rancher v2.12.0; turn to the [SUSE Rancher Application Collection](https://apps.rancher.io) build of Istio for enhanced security (included in SUSE Rancher Prime subscriptions).
|
||||
|
||||
Detailed information can be found in [this announcement](https://forums.suse.com/t/deprecation-of-rancher-istio/45043).
|
||||
|
||||
:::
|
||||
|
||||
If you have restrictive Pod Security Policies enabled, then Istio may not be able to function correctly, because it needs certain permissions in order to install itself and manage pod infrastructure. In this section, we will configure a cluster with PSPs enabled for an Istio install, and also set up the Istio CNI plugin.
|
||||
|
||||
The Istio CNI plugin removes the need for each application pod to have a privileged `NET_ADMIN` container. For further information, see the [Istio CNI Plugin docs](https://istio.io/docs/setup/additional-setup/cni). Please note that the [Istio CNI Plugin is in alpha](https://istio.io/about/feature-stages/).
|
||||
|
||||
:::note Prerequisites:
|
||||
|
||||
- The cluster must be an RKE Kubernetes cluster.
|
||||
- The cluster must have been created with a default PodSecurityPolicy.
|
||||
|
||||
To enable pod security policy support when creating a Kubernetes cluster in the Rancher UI, go to <b>Advanced Options.</b> In the <b>Pod Security Policy Support</b> section, click <b>Enabled.</b> Then select a default pod security policy.
|
||||
|
||||
:::
|
||||
|
||||
1. [Set the PodSecurityPolicy to unrestricted](#1-set-the-podsecuritypolicy-to-unrestricted)
|
||||
2. [Enable the CNI](#2-enable-the-cni)
|
||||
3. [Verify that the CNI is working.](#3-verify-that-the-cni-is-working)
|
||||
|
||||
### 1. Set the PodSecurityPolicy to unrestricted
|
||||
|
||||
An unrestricted PSP allows Istio to be installed.
|
||||
|
||||
Set the PSP to `unrestricted` in the project where is Istio is installed, or the project where you plan to install Istio.
|
||||
|
||||
1. Click **☰ > Cluster Management**.
|
||||
1. Go to the cluster that you created and click **Explore**.
|
||||
1. Click **Cluster > Projects/Namespaces**.
|
||||
1. Find the **Project: System** and select the **⋮ > Edit Config**.
|
||||
1. Change the Pod Security Policy option to be unrestricted, then click **Save**.
|
||||
|
||||
### 2. Enable the CNI
|
||||
|
||||
When installing or upgrading Istio through **Apps,**
|
||||
|
||||
1. Click **Components**.
|
||||
2. Check the box next to **Enabled CNI**.
|
||||
3. Finish installing or upgrading Istio.
|
||||
|
||||
The CNI can also be enabled by editing the `values.yaml`:
|
||||
|
||||
```
|
||||
istio_cni.enabled: true
|
||||
```
|
||||
|
||||
Istio should install successfully with the CNI enabled in the cluster.
|
||||
|
||||
### 3. Verify that the CNI is working
|
||||
|
||||
Verify that the CNI is working by deploying a [sample application](https://istio.io/latest/docs/examples/bookinfo/) or deploying one of your own applications.
|
||||
|
||||
-4
@@ -151,10 +151,6 @@ Option to enable or disable [Metrics Server](https://rancher.com/docs/rke/latest
|
||||
|
||||
Each cloud provider capable of launching a cluster using RKE can collect metrics and monitor for your cluster nodes. Enable this option to view your node metrics from your cloud provider's portal.
|
||||
|
||||
### Pod Security Policy Support
|
||||
|
||||
Enables [pod security policies](../../../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md) for the cluster. After enabling this option, choose a policy using the **Default Pod Security Policy** drop-down.
|
||||
|
||||
You must have an existing Pod Security Policy configured before you can use this option.
|
||||
|
||||
### Docker Version on Nodes
|
||||
|
||||
-4
@@ -129,10 +129,6 @@ If the cloud provider you want to use is not listed as an option, you will need
|
||||
|
||||
:::
|
||||
|
||||
##### Default Pod Security Policy
|
||||
|
||||
The default [pod security policy](../../../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md) for the cluster. Please refer to the [RKE2 documentation](https://docs.rke2.io/security/pod_security_policies) on the specifications of each available policy.
|
||||
|
||||
##### Pod Security Admission Configuration Template
|
||||
|
||||
The default [pod security admission configuration template](../../../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/psa-config-templates.md) for the cluster.
|
||||
|
||||
@@ -26,25 +26,19 @@ Each self-assessment guide is accompanied by a hardening guide. These guides wer
|
||||
|
||||
| Kubernetes Version | CIS Benchmark Version | Self Assessment Guide | Hardening Guides |
|
||||
|--------------------|-----------------------|-----------------------|------------------|
|
||||
| Kubernetes v1.23 | CIS v1.23 | [Link](rke1-hardening-guide/rke1-self-assessment-guide-with-cis-v1.23-k8s-v1.23.md) | [Link](rke1-hardening-guide/rke1-hardening-guide.md) |
|
||||
| Kubernetes v1.24 | CIS v1.24 | [Link](rke1-hardening-guide/rke1-self-assessment-guide-with-cis-v1.24-k8s-v1.24.md) | [Link](rke1-hardening-guide/rke1-hardening-guide.md) |
|
||||
| Kubernetes v1.25/v1.26/v1.27 | CIS v1.7 | [Link](rke1-hardening-guide/rke1-self-assessment-guide-with-cis-v1.7-k8s-v1.25-v1.26-v1.27.md) | [Link](rke1-hardening-guide/rke1-hardening-guide.md) |
|
||||
|
||||
### RKE2 Guides
|
||||
|
||||
| Type | Kubernetes Version | CIS Benchmark Version | Self Assessment Guide | Hardening Guides |
|
||||
|------|--------------------|-----------------------|-----------------------|------------------|
|
||||
| Rancher provisioned RKE2 | Kubernetes v1.23 | CIS v1.23 | [Link](rke2-hardening-guide/rke2-self-assessment-guide-with-cis-v1.23-k8s-v1.23.md) | [Link](rke2-hardening-guide/rke2-hardening-guide.md) |
|
||||
| Rancher provisioned RKE2 | Kubernetes v1.24 | CIS v1.24 | [Link](rke2-hardening-guide/rke2-self-assessment-guide-with-cis-v1.24-k8s-v1.24.md) | [Link](rke2-hardening-guide/rke2-hardening-guide.md) |
|
||||
| Rancher provisioned RKE2 | Kubernetes v1.25/v1.26/v1.27 | CIS v1.7 | [Link](rke2-hardening-guide/rke2-self-assessment-guide-with-cis-v1.7-k8s-v1.25-v1.26-v1.27.md) | [Link](rke2-hardening-guide/rke2-hardening-guide.md) |
|
||||
| Standalone RKE2 | Kubernetes v1.25/v1.26/v1.27 | CIS v1.7 | [Link](https://docs.rke2.io/security/cis_self_assessment123) | [Link](https://docs.rke2.io/security/hardening_guide) |
|
||||
| Standalone RKE2 | Kubernetes v1.27-v1.32 | CIS v1.9 | [Link](https://docs.rke2.io/security/cis_self_assessment19) | [Link](https://docs.rke2.io/security/hardening_guide) |
|
||||
|
||||
### K3s Guides
|
||||
|
||||
| Type | Kubernetes Version | CIS Benchmark Version | Self Assessment Guide | Hardening Guides |
|
||||
|------|--------------------|-----------------------|-----------------------|------------------|
|
||||
| Rancher provisioned K3s cluster | Kubernetes v1.23 | CIS v1.23 | [Link](k3s-hardening-guide/k3s-self-assessment-guide-with-cis-v1.23-k8s-v1.23.md) | [Link](k3s-hardening-guide/k3s-hardening-guide.md) |
|
||||
| Rancher provisioned K3s cluster | Kubernetes v1.24 | CIS v1.24 | [Link](k3s-hardening-guide/k3s-self-assessment-guide-with-cis-v1.24-k8s-v1.24.md) | [Link](k3s-hardening-guide/k3s-hardening-guide.md) |
|
||||
| Rancher provisioned K3s cluster | Kubernetes v1.25/v1.26/v1.27 | CIS v1.7 | [Link](k3s-hardening-guide/k3s-self-assessment-guide-with-cis-v1.7-k8s-v1.25-v1.26-v1.27.md) | [Link](k3s-hardening-guide/k3s-hardening-guide.md) |
|
||||
| Standalone K3s | Kubernetes v1.22 up to v1.24 | CIS v1.23 | [Link](https://docs.k3s.io/security/self-assessment-1.8) | [Link](https://docs.k3s.io/security/hardening-guide) |
|
||||
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ This configuration needs to be done before setting the kubelet flag, otherwise K
|
||||
|
||||
## Kubernetes Runtime Requirements
|
||||
|
||||
The CIS Benchmark runtime requirements center around pod security (via PSP or PSA), network policies and API Server auditing logs.
|
||||
The CIS Benchmark runtime requirements center around pod security (via PSA), network policies and API Server auditing logs.
|
||||
|
||||
By default, K3s does not include any pod security or network policies. However, K3s ships with a controller that enforces any network policies you create. By default, K3s enables both the `PodSecurity` and `NodeRestriction` admission controllers, among others.
|
||||
|
||||
|
||||
-3152
File diff suppressed because it is too large
Load Diff
-3208
File diff suppressed because it is too large
Load Diff
-1
@@ -153,7 +153,6 @@ Execute this script to apply the `default-allow-all.yaml` configuration with the
|
||||
## Known Limitations
|
||||
|
||||
- Rancher **exec shell** and **view logs** for pods are **not** functional in a hardened setup when only a public IP is provided when registering custom nodes. This functionality requires a private IP to be provided when registering the custom nodes.
|
||||
- When setting `default_pod_security_policy_template_id:` to `restricted` or `restricted-noroot`, based on the pod security policies (PSP) [provided](../../../../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md) by Rancher, Rancher creates `RoleBindings` and `ClusterRoleBindings` on the `default` service accounts. The CIS check 5.1.5 requires that the `default` service accounts have no roles or cluster roles bound to it apart from the defaults. In addition, the `default` service accounts should be configured such that it does not provide a service account token and does not have any explicit rights assignments.
|
||||
|
||||
## Reference Hardened RKE `cluster.yml` Configuration
|
||||
|
||||
|
||||
-3089
File diff suppressed because one or more lines are too long
-3049
File diff suppressed because it is too large
Load Diff
-3200
File diff suppressed because one or more lines are too long
-3202
File diff suppressed because one or more lines are too long
@@ -12,7 +12,6 @@
|
||||
| [Ability to rotate certificates](../how-to-guides/new-user-guides/manage-clusters/rotate-certificates.md) | ✓ | ✓ | | |
|
||||
| Ability to [backup](../how-to-guides/new-user-guides/backup-restore-and-disaster-recovery/back-up-rancher-launched-kubernetes-clusters.md) and [restore](../how-to-guides/new-user-guides/backup-restore-and-disaster-recovery/restore-rancher-launched-kubernetes-clusters-from-backup.md) Rancher-launched clusters | ✓ | ✓ | | ✓<sup>4</sup> |
|
||||
| [Cleaning Kubernetes components when clusters are no longer reachable from Rancher](../how-to-guides/new-user-guides/manage-clusters/clean-cluster-nodes.md) | ✓ | | | |
|
||||
| [Configuring Pod Security Policies](../how-to-guides/new-user-guides/manage-clusters/add-a-pod-security-policy.md) | ✓ | ✓ | ||
|
||||
|
||||
1. Registered EKS, GKE and AKS clusters have the same options available as EKS, GKE and AKS clusters created from the Rancher UI. The difference is that when a registered cluster is deleted from the Rancher UI, it is not destroyed.
|
||||
|
||||
|
||||
@@ -1178,10 +1178,6 @@ module.exports = {
|
||||
to: '/how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/about-rke1-templates/example-use-cases',
|
||||
from: '/how-to-guides/advanced-user-guides/authentication-permissions-and-global-configuration/about-rke1-templates/example-use-cases'
|
||||
},
|
||||
{
|
||||
to: '/how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies',
|
||||
from: '/how-to-guides/advanced-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies'
|
||||
},
|
||||
{
|
||||
to: '/how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/global-default-private-registry',
|
||||
from: '/how-to-guides/advanced-user-guides/authentication-permissions-and-global-configuration/global-default-private-registry'
|
||||
@@ -1266,14 +1262,6 @@ module.exports = {
|
||||
to: '/how-to-guides/new-user-guides/manage-clusters/clean-cluster-nodes',
|
||||
from: '/how-to-guides/advanced-user-guides/manage-clusters/clean-cluster-nodes'
|
||||
},
|
||||
{
|
||||
to: '/how-to-guides/new-user-guides/manage-clusters/add-a-pod-security-policy',
|
||||
from: '/how-to-guides/advanced-user-guides/manage-clusters/add-a-pod-security-policy'
|
||||
},
|
||||
{
|
||||
to: '/how-to-guides/new-user-guides/manage-clusters/assign-pod-security-policies',
|
||||
from: '/how-to-guides/advanced-user-guides/manage-clusters/assign-pod-security-policies'
|
||||
},
|
||||
{
|
||||
to: '/how-to-guides/new-user-guides/launch-kubernetes-with-rancher/use-new-nodes-in-an-infra-provider/create-an-amazon-ec2-cluster',
|
||||
from: '/how-to-guides/new-user-guides/kubernetes-clusters-in-rancher-setup/launch-kubernetes-with-rancher/use-new-nodes-in-an-infra-provider/create-an-amazon-ec2-cluster'
|
||||
@@ -1449,10 +1437,6 @@ module.exports = {
|
||||
to: '/integrations-in-rancher/istio/disable-istio',
|
||||
from: '/explanations/integrations-in-rancher/istio/disable-istio'
|
||||
},
|
||||
{
|
||||
to: '/integrations-in-rancher/istio/configuration-options/pod-security-policies',
|
||||
from: '/explanations/integrations-in-rancher/istio/configuration-options/pod-security-policies'
|
||||
},
|
||||
{
|
||||
to: '/integrations-in-rancher/istio/configuration-options/selectors-and-scrape-configurations',
|
||||
from: '/explanations/integrations-in-rancher/istio/configuration-options/selectors-and-scrape-configurations'
|
||||
@@ -1517,26 +1501,6 @@ module.exports = {
|
||||
to: '/integrations-in-rancher/neuvector',
|
||||
from: '/explanations/integrations-in-rancher/neuvector'
|
||||
}, // Redirects for restructure from PR #234 (end)
|
||||
{
|
||||
to: '/reference-guides/rancher-security/hardening-guides/k3s-hardening-guide/k3s-self-assessment-guide-with-cis-v1.24-k8s-v1.24',
|
||||
from: '/reference-guides/rancher-security/hardening-guides/k3s-hardening-guide/k3s-self-assessment-guide-with-cis-v1.23-k8s-v1.24'
|
||||
},
|
||||
{
|
||||
to: '/reference-guides/rancher-security/hardening-guides/k3s-hardening-guide/k3s-self-assessment-guide-with-cis-v1.7-k8s-v1.25-v1.26-v1.27',
|
||||
from: '/reference-guides/rancher-security/hardening-guides/k3s-hardening-guide/k3s-self-assessment-guide-with-cis-v1.23-k8s-v1.25'
|
||||
},
|
||||
{
|
||||
to: '/reference-guides/rancher-security/hardening-guides/rke1-hardening-guide/rke1-self-assessment-guide-with-cis-v1.24-k8s-v1.24',
|
||||
from: '/reference-guides/rancher-security/hardening-guides/rke1-hardening-guide/rke1-self-assessment-guide-with-cis-v1.23-k8s-v1.24'
|
||||
},
|
||||
{
|
||||
to: '/reference-guides/rancher-security/hardening-guides/rke1-hardening-guide/rke1-self-assessment-guide-with-cis-v1.7-k8s-v1.25-v1.26-v1.27',
|
||||
from: '/reference-guides/rancher-security/hardening-guides/rke1-hardening-guide/rke1-self-assessment-guide-with-cis-v1.23-k8s-v1.25'
|
||||
},
|
||||
{
|
||||
to: '/reference-guides/rancher-security/hardening-guides/rke2-hardening-guide/rke2-self-assessment-guide-with-cis-v1.24-k8s-v1.24',
|
||||
from: '/reference-guides/rancher-security/hardening-guides/rke2-hardening-guide/rke2-self-assessment-guide-with-cis-v1.23-k8s-v1.24'
|
||||
},
|
||||
{
|
||||
to: '/reference-guides/rancher-security/hardening-guides/rke2-hardening-guide/rke2-self-assessment-guide-with-cis-v1.7-k8s-v1.25-v1.26-v1.27',
|
||||
from: '/reference-guides/rancher-security/hardening-guides/rke2-hardening-guide/rke2-self-assessment-guide-with-cis-v1.23-k8s-v1.25'
|
||||
|
||||
-3
@@ -194,7 +194,6 @@ cert-manager-webhook-787858fcdb-nlzsq 1/1 Running 0 2m
|
||||
- 将 `hostname` 设置为解析到你的负载均衡器的 DNS 名称。
|
||||
- 将 `bootstrapPassword` 设置为 `admin` 用户独有的值。
|
||||
- 如果你需要安装指定的 Rancher 版本,使用 `--version` 标志,例如 `--version 2.7.0`。
|
||||
- 对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
```
|
||||
helm install rancher rancher-<CHART_REPO>/rancher \
|
||||
@@ -235,7 +234,6 @@ deployment "rancher" successfully rolled out
|
||||
- 将 `ingress.tls.source` 设置为 `letsEncrypt`。
|
||||
- 将 `letsEncrypt.email` 设置为可通讯的电子邮件地址,用于发送通知(例如证书到期的通知)。
|
||||
- 将 `letsEncrypt.ingress.class` 设为你的 Ingress Controller(例如 `traefik`,`nginx`,`haproxy`)
|
||||
- 对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
```
|
||||
helm install rancher rancher-<CHART_REPO>/rancher \
|
||||
@@ -278,7 +276,6 @@ deployment "rancher" successfully rolled out
|
||||
- 设置 `hostname`。
|
||||
- 将 `bootstrapPassword` 设置为 `admin` 用户独有的值。
|
||||
- 将 `ingress.tls.source` 设置为 `secret`。
|
||||
- 对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
```
|
||||
helm install rancher rancher-<CHART_REPO>/rancher \
|
||||
|
||||
-68
@@ -1,68 +0,0 @@
|
||||
---
|
||||
title: 将加固的自定义/导入集群升级到 Kubernetes v1.25
|
||||
---
|
||||
|
||||
Kubernetes v1.25 改变了集群描述和执行安全策略的方式。从这个版本开始,[Pod 安全策略 (PSP)](https://kubernetes.io/docs/concepts/security/pod-security-policy/)不再可用。Kubernetes v1.25 将它们替换为新的安全对象:[Pod 安全标准 (PSS)](https://kubernetes.io/docs/concepts/security/pod-security-standards/) 和 [Pod 安全准入 (PSA)](https://kubernetes.io/docs/concepts/security/pod-security-admission/)。
|
||||
|
||||
如果你具有自定义或导入的加固集群,你需要做好准备,确保将旧版本的 Kubernetes 顺利升级到 v1.25 或更高版本。
|
||||
|
||||
:::note
|
||||
|
||||
升级到 v1.25 后,添加必要的 Rancher 命名空间豁免。有关详细信息,请参阅 [Pod 安全准入 (PSA) 配置模板](../../../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/psa-config-templates.md#豁免必须的-rancher-命名空间)。
|
||||
|
||||
:::
|
||||
|
||||
## 将导入的加固集群升级到 Kubernetes v1.25 或更高版本
|
||||
|
||||
<Tabs groupId="k8s-distro">
|
||||
<TabItem value="RKE2" default>
|
||||
|
||||
在集群中的每个节点上执行以下操作:
|
||||
1. 将 [`rancher-psact.yaml`](./rancher-psact.yaml) 保存到 `/etc/rancher/rke2` 中。
|
||||
1. 编辑 RKE2 配置文件:
|
||||
1. 将 `profile` 字段更新为 `cis-1.23`。
|
||||
1. 指定刚才添加的配置文件的路径:`pod-security-admission-config-file: /etc/rancher/rke2/rancher-psact.yaml`。
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="K3s">
|
||||
|
||||
在集群中的每个节点上执行以下操作:
|
||||
|
||||
遵循 K3s [将加固集群从 v1.24.x 升级到 v1.25.x](https://docs.k3s.io/known-issues#hardened-125)的官方说明,但使用[自定义](./rancher-psact.yaml)Rancher PSA 配置模板,而不是 K3s 官方网站上提供的配置。
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
执行这些步骤后,你可以通过 Rancher UI 升级集群的 Kubernetes 版本:
|
||||
|
||||
1. 在左上角,单击 **☰ > 集群管理**。
|
||||
1. 在**集群**表中找到要更新的集群,点击 **⋮**。
|
||||
1. 选择**编辑配置**。
|
||||
1. 在 **Kubernetes 版本**下拉菜单中,选择要使用的版本。
|
||||
1. 单击**保存**。
|
||||
|
||||
## 将自定义加固集群升级到 Kubernetes v1.25 或更高版本
|
||||
|
||||
<Tabs groupId="k8s-distro">
|
||||
<TabItem value="RKE2" default>
|
||||
|
||||
1. 在左上角,单击 **☰ > 集群管理**。
|
||||
1. 在**集群**表中找到要更新的集群,点击 **⋮**。
|
||||
1. 选择**编辑配置**。
|
||||
1. 在**基本信息 > 安全**下的 **CIS 配置文件**下拉菜单中,选择 `cis-1.23`。
|
||||
1. 在 **PSA 配置模板**下拉菜单中,选择 `rancher-restricted`。
|
||||
1. 在 **Kubernetes 版本**下拉菜单中,选择要使用的版本。
|
||||
1. 单击**保存**。
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="K3s">
|
||||
|
||||
1. 在左上角,单击 **☰ > 集群管理**。
|
||||
1. 在**集群**表中找到要更新的集群,点击 **⋮**。
|
||||
1. 选择**编辑 YAML**。
|
||||
1. 从 `kube-apiserver-arg.enable-admission-plugins` 中删除 `PodSecurityPolicy`。
|
||||
1. 在 `spec` 字段中,添加一行:`defaultPodSecurityAdmissionConfigurationTemplateName: rancher-restricted`
|
||||
1. 将 `kubernetesVersion` 更新为你选择的版本(v1.25 或更高版本)。
|
||||
1. 单击**保存**。
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
-4
@@ -149,8 +149,6 @@ hostname: rancher.my.org
|
||||
|
||||
将上一步中的所有值用 `--set key=value` 追加到命令中。
|
||||
|
||||
对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
```
|
||||
helm upgrade rancher rancher-<CHART_REPO>/rancher \
|
||||
--namespace cattle-system \
|
||||
@@ -183,8 +181,6 @@ helm upgrade rancher-stable rancher-<CHART_REPO>/rancher \
|
||||
```
|
||||
1. 只更新 Rancher 版本:
|
||||
|
||||
对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
```
|
||||
helm upgrade rancher rancher-<CHART_REPO>/rancher \
|
||||
--namespace cattle-system \
|
||||
|
||||
-2
@@ -58,8 +58,6 @@ keywords: [rancher helm chart, rancher helm 选项, rancher helm chart 选项, h
|
||||
| `systemDefaultRegistry` | "" | `string` - 用于所有系统容器镜像的私有仓库,例如 http://registry.example.com/ |
|
||||
| `tls` | "ingress" | `string` - 详情请参见[外部 TLS 终止](#外部-tls-终止)。- "ingress, external" |
|
||||
| `useBundledSystemChart` | `false` | `bool` - 选择 Rancher Server 打包的 system-charts。此参数用于离线环境安装。 |
|
||||
| `global.cattle.psp.enabled` | `true` | `bool` - 使用 Rancher v2.7.2-v2.7.4 时,选择 `false` 以禁用 Kubernetes v1.25 及更高版本的 PSP。使用 Rancher v2.7.5 及更高版本时,Rancher 会尝试检测集群是否运行不支持 PSP 的 Kubernetes 版本,如果确定集群不支持 PSP,则将默认 PSP 的使用设置为 false。你仍然可以通过显式提供此值的 `true` 或 `false` 来手动覆盖此值。在支持 PSP 的集群中(例如使用 Kubernetes v1.24 或更低版本的集群),Rancher 仍将默认使用 PSP。 |
|
||||
|
||||
|
||||
### 引导密码
|
||||
|
||||
|
||||
-4
@@ -168,8 +168,6 @@ kubectl create namespace cattle-system
|
||||
|
||||
然后安装 Rancher,并声明你选择的选项。参考下表来替换每个占位符。Rancher 需要配置为使用私有镜像仓库,以便配置所有 Rancher 启动的 Kubernetes 集群或 Rancher 工具。
|
||||
|
||||
对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
| 占位符 | 描述 |
|
||||
------------|-------------
|
||||
| `<VERSION>` | 输出压缩包的版本号。 |
|
||||
@@ -199,8 +197,6 @@ kubectl create namespace cattle-system
|
||||
|
||||
安装 Rancher,并声明你选择的选项。参考下表来替换每个占位符。Rancher 需要配置为使用私有镜像仓库,以便配置所有 Rancher 启动的 Kubernetes 集群或 Rancher 工具。
|
||||
|
||||
对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
| 占位符 | 描述 |
|
||||
| -------------------------------- | ----------------------------------------------- |
|
||||
| `<VERSION>` | 输出压缩包的版本号。 |
|
||||
|
||||
@@ -31,7 +31,7 @@ Rancher API Server 是基于嵌入式 Kubernetes API Server 和 etcd 数据库
|
||||
### 授权和基于角色的权限控制(RBAC)
|
||||
|
||||
- **用户管理**:Rancher API Server 除了管理本地用户,还[管理用户用来访问外部服务所需的认证信息](../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/authentication-config/authentication-config.md),如登录 Active Directory 和 GitHub 所需的账号密码。
|
||||
- **授权**:Rancher API Server 可以管理[访问控制策略](../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/manage-role-based-access-control-rbac/manage-role-based-access-control-rbac.md)和[安全策略](../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md)。
|
||||
- **授权**:Rancher API Server 可以管理[访问控制策略](../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/manage-role-based-access-control-rbac/manage-role-based-access-control-rbac.md)和[安全标准](../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/pod-security-standards.md)。
|
||||
|
||||
### 使用 Kubernetes 的功能
|
||||
|
||||
|
||||
-2
@@ -124,8 +124,6 @@ helm install cert-manager jetstack/cert-manager `
|
||||
|
||||
要安装特定的 Rancher 版本,请使用 `--version` 标志(例如,`--version 2.6.6`)。否则,默认安装最新的 Rancher。请参阅[选择 Rancher 版本](../../installation-and-upgrade/resources/choose-a-rancher-version.md)。
|
||||
|
||||
对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
请注意,密码至少需要 12 个字符。
|
||||
|
||||
```
|
||||
|
||||
-6
@@ -9,9 +9,3 @@ title: 安装 Rancher CIS Benchmark
|
||||
1. 单击**安装**。
|
||||
|
||||
**结果**:CIS 扫描应用已经部署在 Kubernetes 集群上。
|
||||
|
||||
:::note
|
||||
|
||||
如果你使用 Kubernetes v1.24 或更早版本,并且具有使用 [Pod 安全策略](../../new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md) (PSP) 加固的集群,则 CIS Benchmark 4.0.0 及更高版本会默认禁用 PSP。要在 PSP 加固集群上安装 CIS Benchmark,请在安装 Chart 之前将 values 中的 `global.psp.enabled` 设置为 `true`。[Pod 安全准入](../../new-user-guides/authentication-permissions-and-global-configuration/pod-security-standards.md) (PSA) 加固集群不受影响。
|
||||
|
||||
:::
|
||||
|
||||
-2
@@ -39,8 +39,6 @@ Rancher 包含一些默认关闭的实验功能。在某些情况下,例如当
|
||||
|
||||
使用 Helm Chart 安装 Rancher 时,使用 `--set` 选项。下面的示例通过传递功能开关名称(用逗号分隔)来启用两个功能:
|
||||
|
||||
对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
```
|
||||
helm install rancher rancher-latest/rancher \
|
||||
--namespace cattle-system \
|
||||
|
||||
-1
@@ -5,7 +5,6 @@ title: 1. 在集群中启用 Istio
|
||||
:::note 先决条件:
|
||||
|
||||
- 只有分配了 `cluster-admin` [Kubernetes 默认角色](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles)的用户可以在 Kubernetes 集群中配置和安装 Istio。
|
||||
- 如果你有 pod 安全策略,则需要安装启用了 CNI 的 Istio。有关详细信息,请参阅[本节](../../../integrations-in-rancher/istio/configuration-options/pod-security-policies.md)。
|
||||
- 要在 RKE2 集群上安装 Istio,则需要执行额外的步骤。有关详细信息,请参阅[本节](../../../integrations-in-rancher/istio/configuration-options/install-istio-on-rke2-cluster.md)。
|
||||
- 要在启用了项目网络隔离的集群中安装 Istio,则需要执行额外的步骤。有关详细信息,请参阅[本节](../../../integrations-in-rancher/istio/configuration-options/project-network-isolation.md)。
|
||||
|
||||
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
---
|
||||
title: Pod 安全策略
|
||||
---
|
||||
|
||||
:::note
|
||||
|
||||
本文介绍的集群选项仅适用于 [Rancher 已在其中启动 Kubernetes 的集群](../../new-user-guides/launch-kubernetes-with-rancher/launch-kubernetes-with-rancher.md)。
|
||||
|
||||
:::
|
||||
|
||||
你可以在创建项目的时候设置 Pod 安全策略(PSP)。如果在创建项目期间没有为项目分配 PSP,你也随时可以将 PSP 分配给现有项目。
|
||||
|
||||
## 先决条件
|
||||
|
||||
- 在 Rancher 中创建 Pod 安全策略。在将默认 PSP 分配给现有项目之前,你必须有一个可分配的 PSP。有关说明,请参阅[创建 Pod 安全策略](../../new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md)。
|
||||
- 将默认 Pod 安全策略分配给项目所属的集群。如果 PSP 还没有应用到集群,你无法将 PSP 分配给项目。有关详细信息,请参阅[将 pod 安全策略添加到集群](../../new-user-guides/manage-clusters/add-a-pod-security-policy.md)。
|
||||
|
||||
## 应用 Pod 安全策略
|
||||
|
||||
1. 在左上角,单击 **☰ > 集群管理**。
|
||||
1. 在**集群**页面上,转到需要移动命名空间的集群,然后单击 **Explore**。
|
||||
1. 单击**集群 > 项目/命名空间**。
|
||||
1. 找到要添加 PSP 的项目。在该项目中选择 **⋮ > 编辑配置**。
|
||||
1. 从 **Pod 安全策略**下拉列表中,选择要应用于项目的 PSP。
|
||||
将 PSP 分配给项目将:
|
||||
|
||||
- 覆盖集群的默认 PSP。
|
||||
- 将 PSP 应用于项目。
|
||||
- 将 PSP 应用到后续添加到项目中的命名空间。
|
||||
|
||||
1. 单击**保存**。
|
||||
|
||||
**结果**:已将 PSP 应用到项目以及项目内的命名空间。
|
||||
|
||||
:::note
|
||||
|
||||
对于在分配 PSP 之前已经在集群或项目中运行工作负载,Rancher 不会检查它们是否符合 PSP。你需要克隆或升级工作负载以查看它们是否通过 PSP。
|
||||
|
||||
:::
|
||||
-1
@@ -24,7 +24,6 @@ _项目_ 是 Rancher 中引入的对象,可帮助你更有组织地管理 Kube
|
||||
- [设置资源配额](manage-project-resource-quotas/manage-project-resource-quotas.md)
|
||||
- [管理命名空间](../../new-user-guides/manage-namespaces.md)
|
||||
- [配置工具](../../../reference-guides/rancher-project-tools.md)
|
||||
- [配置 Pod 安全策略](manage-pod-security-policies.md)
|
||||
|
||||
## 授权
|
||||
|
||||
|
||||
-7
@@ -29,13 +29,6 @@ Rancher 为 Kubernetes 增加了一项关键特性是集中式的用户认证。
|
||||
在 Rancher 中,每个人都是以 _用户_ 的身份进行鉴权,这是一个授予你访问 Rancher 的登录身份。用户登录 Rancher 后,他们的 _授权_ 或者他们在系统中的访问权限由用户的角色决定。Rancher 提供了内置的角色,允许你你轻松地配置用户对资源的权限,但是 Rancher 还提供了为每个 Kubernetes 资源自定义角色的功能。
|
||||
|
||||
更多关于授权的工作原理以及自定义角色的使用,请参考 [RBAC](manage-role-based-access-control-rbac/manage-role-based-access-control-rbac.md)。
|
||||
|
||||
## Pod 安全策略
|
||||
|
||||
_Pod 安全策略_ (或 PSPs) 是控制 Pod 安全敏感方面规范的对象,例如 root 权限。如果一个 Pod 不满足 PSP 中指定的条件,Kubernetes 将不允许 Pod 启动,同时 Rancher 会显示一条错误信息。
|
||||
|
||||
更多关于如何创建和使用 PSPs 的内容,请参考 [Pod 安全策略](create-pod-security-policies.md)。
|
||||
|
||||
## Provisioning Drivers
|
||||
|
||||
Rancher 中的驱动允许你管理哪些程序可以预置[托管的 Kubernetes 集群](../kubernetes-clusters-in-rancher-setup/set-up-clusters-from-hosted-kubernetes-providers/set-up-clusters-from-hosted-kubernetes-providers.md) 或 [云服务器节点](../launch-kubernetes-with-rancher/use-new-nodes-in-an-infra-provider/use-new-nodes-in-an-infra-provider.md),允许 Rancher 部署和管理 Kubernetes。
|
||||
|
||||
-78
@@ -1,78 +0,0 @@
|
||||
---
|
||||
title: Pod 安全策略
|
||||
---
|
||||
|
||||
:::caution
|
||||
Pod 安全策略仅在 Kubernetes v1.24 之前可用。[Pod 安全标准](pod-security-standards.md) 是内置的替代方案。
|
||||
:::
|
||||
|
||||
[Pod 安全策略(PSP)](https://kubernetes.io/docs/concepts/security/pod-security-policy/)是用来控制安全敏感相关 Pod 规范(例如 root 特权)的对象。
|
||||
|
||||
如果某个 Pod 不满足 PSP 指定的条件,Kubernetes 将不允许它启动,Rancher 中将显示错误消息 `Pod <NAME> is forbidden: unable to validate...`。
|
||||
|
||||
|
||||
## PSP 工作原理
|
||||
|
||||
你可以在集群或项目级别分配 PSP。
|
||||
|
||||
PSP 通过继承的方式工作:
|
||||
|
||||
- 默认情况下,分配给集群的 PSP 由其项目以及添加到这些项目的任何命名空间继承。
|
||||
- **例外**:无论 PSP 是分配给集群还是项目,未分配给项目的命名空间不会继承 PSP。因为这些命名空间没有 PSP,所以这些命名空间的工作负载 deployment 将失败,这是 Kubernetes 的默认行为。
|
||||
- 你可以通过将不同的 PSP 直接分配给项目来覆盖默认 PSP。
|
||||
|
||||
在分配 PSP 之前已经在集群或项目中运行的任何工作负载如果符合 PSP,则不会被检查。你需要克隆或升级工作负载以查看它们是否通过 PSP。
|
||||
|
||||
在 [Kubernetes 文档](https://kubernetes.io/docs/concepts/policy/pod-security-policy/)中阅读有关 Pod 安全策略的更多信息。
|
||||
|
||||
## 默认 PSP
|
||||
|
||||
Rancher 内置了三个默认 Pod 安全策略 (PSP),分别是 `restricted-noroot`(受限 noroot),`restricted`(受限)和 `unrestricted`(不受限)策略。
|
||||
|
||||
### 受限-NoRoot
|
||||
|
||||
此策略基于 Kubernetes [示例受限策略](https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/policy/restricted-psp.yaml)。它极大地限制了可以将哪些类型的 Pod 部署到集群或项目中。这项策略:
|
||||
|
||||
- 阻止 Pod 以特权用户身份运行,并防止特权升级。
|
||||
- 验证服务器所需的安全机制是否到位,例如限制哪些卷只能挂载到核心卷类型,并防止添加 root 补充组。
|
||||
|
||||
### 受限
|
||||
|
||||
该策略是宽松版的 `restricted-noroot` 策略,除了允许以特权用户身份运行容器外,几乎所有限制都到位。
|
||||
|
||||
### 不受限
|
||||
|
||||
该策略等效于在禁用 PSP 控制器的情况下运行 Kubernetes。对于可以将哪些 Pod 部署到集群或项目中,它没有任何限制。
|
||||
|
||||
:::note 重要提示:
|
||||
|
||||
禁用 PSP 时,默认 PSP **不会**自动从集群中删除。如果不再需要它们,你必须手动删除它们。
|
||||
|
||||
:::
|
||||
|
||||
## 创建 PSP
|
||||
|
||||
使用 Rancher,你可以使用我们的 GUI 创建 Pod 安全策略,而不是创建 YAML 文件。
|
||||
|
||||
### 要求
|
||||
|
||||
Rancher 只能为[使用 RKE 启动的集群](../launch-kubernetes-with-rancher/launch-kubernetes-with-rancher.md)分配 PSP。
|
||||
|
||||
你必须先在集群级别启用 PSP,然后才能将它们分配给项目。这可以通过[编辑集群](../../../reference-guides/cluster-configuration/cluster-configuration.md)来配置。
|
||||
|
||||
最好的做法是在集群级别设置 PSP。
|
||||
|
||||
我们建议在集群和项目创建期间添加 PSP,而不是将其添加到现有的项目或集群中。
|
||||
|
||||
### 在 Rancher UI 中创建 PSP
|
||||
|
||||
1. 在左上角,单击 **☰ > 集群管理**。
|
||||
1. 在左侧导航栏中,单击 **Pod 安全策略**。
|
||||
1. 单击**添加策略**。
|
||||
1. 为策略命名。
|
||||
1. 填写表格的每个部分。请参阅 [Kubernetes 文档](https://kubernetes.io/docs/concepts/policy/pod-security-policy/),了解每个策略的作用。
|
||||
1. 单击**创建**。
|
||||
|
||||
## 配置
|
||||
|
||||
关于 PSP 的 Kubernetes 文档,请参阅[这里](https://kubernetes.io/docs/concepts/policy/pod-security-policy/)。
|
||||
-57
@@ -7,54 +7,6 @@ title: Pod 安全标准 (PSS) 和 Pod 安全准入 (PSA)
|
||||
|
||||
PSS 定义了工作负载的安全级别。PSA 描述了 Pod 安全上下文和相关字段的要求。PSA 参考 PSS 级别来定义安全限制。
|
||||
|
||||
## 升级到 Pod 安全标准 (PSS)
|
||||
|
||||
确保将所有 PSP 都迁移到了另一个工作负载安全机制,包括将你当前的 PSP 映射到 Pod 安全标准,以便使用 [PSA 控制器](https://kubernetes.io/docs/concepts/security/pod-security-admission/)执行。如果 PSA 控制器不能满足企业的所有需求,建议你使用策略引擎,例如 [OPA Gatekeeper](https://github.com/open-policy-agent/gatekeeper)、[Kubewarden](https://www.kubewarden.io/)、[Kyverno](https://kyverno.io/) 或 [NeuVector](https://neuvector.com/)。有关如何迁移 PSP 的更多信息,请参阅你选择的策略引擎的文档。
|
||||
|
||||
:::caution
|
||||
必须在删除 PodSecurityPolicy 对象_之前_添加新的策略执行机制。否则,你可能会为集群内的特权升级攻击创造机会。
|
||||
:::
|
||||
|
||||
### 从 Rancher 维护的应用程序和市场工作负载中删除 PodSecurityPolicies
|
||||
|
||||
Rancher v2.7.2 提供了 Rancher 维护的 Helm Chart 的新主要版本。v102.x.y 允许你删除与以前的 Chart 版本一起安装的 PSP。这个新版本使用标准化的 `global.cattle.psp.enabled` 开关(默认关闭)替换了非标准的 PSP 开关。
|
||||
|
||||
你必须在_仍使用 Kubernetes v1.24_ 时执行以下步骤:
|
||||
1. 根据需要配置 PSA 控制器。你可以使用 Rancher 的内置 [PSA 配置模板](#pod-安全准入配置模板),或创建自定义模板并将其应用于正在迁移的集群。
|
||||
|
||||
1. 将活动的 PSP 映射到 Pod 安全标准:
|
||||
1. 查看集群中哪些 PSP 仍处于活动状态:
|
||||
:::caution
|
||||
此策略可能会错过当前未运行的工作负载,例如 CronJobs、当前缩放为零的工作负载或尚未推出的工作负载。
|
||||
:::
|
||||
|
||||
```shell
|
||||
kubectl get pods \
|
||||
--all-namespaces \
|
||||
--output jsonpath='{.items[*].metadata.annotations.kubernetes\.io\/psp}' \
|
||||
| tr " " "\n" | sort -u
|
||||
```
|
||||
|
||||
1. 按照[将 PSP 映射到 Pod 安全标准](https://kubernetes.io/docs/reference/access-authn-authz/psp-to-pod-security-standards/)的 Kubernetes 指南将 PSS 应用于依赖 PSP 的工作负载。有关详细信息,请参阅[从 PodSecurityPolicy 迁移到内置 PodSecurity Admission 控制器](https://kubernetes.io/docs/tasks/configure-pod-container/migrate-from-psp/)。
|
||||
|
||||
1. 要从 Rancher Chart 中删除 PSP,请在升级到 Kubernetes v1.25 _之前_将 Chart 升级到最新的 v102.x.y 版本。确保 **Enable PodSecurityPolicies** 选项**已禁用**。这将删除与以前的 Chart 版本一起安装的所有 PSP。
|
||||
|
||||
:::info 重要提示
|
||||
如果你想将 Chart 升级到 v102.x.y,但不打算将集群升级到 Kubernetes v1.25 和弃用 PSP,请确保为每个要升级的 Chart 选择 **Enable PodSecurityPolicies** 选项。
|
||||
:::
|
||||
|
||||
### 在 Kubernetes v1.25 升级后清理版本
|
||||
|
||||
如果你在删除 Chart 的 PSP 时遇到问题,或者 Chart 不包含用于删除 PSP 的内置机制,Chart 升级或删除可能会失败并显示如下错误消息:
|
||||
```console
|
||||
Error: UPGRADE FAILED: resource mapping not found for name: "<object-name>" namespace: "<object-namespace>" from "": no matches for kind "PodSecurityPolicy" in version "policy/v1beta1"
|
||||
ensure CRDs are installed first
|
||||
```
|
||||
|
||||
Helm 尝试在集群中查询存储在先前版本的数据 blob 中的对象时,就会发生这种情况。要清理这些版本并避免此错误,请使用 `helm-mapkubeapis` Helm 插件。要详细了解 `helm-mapkubeapis`、它的工作原理以及如何针对你的用例进行微调,请参阅 [Helm 官方文档](https://github.com/helm/helm-mapkubeapis#readme)。
|
||||
|
||||
请注意,Helm 插件安装在你运行命令的机器本地。因此,请确保从同一台机器运行安装和清理。
|
||||
|
||||
#### 安装 `helm-mapkubeapis`
|
||||
|
||||
1. 在打算使用 `helm-mapkubeapis` 的机器上打开你的终端并安装插件:
|
||||
@@ -106,15 +58,6 @@ Helm 尝试在集群中查询存储在先前版本的数据 blob 中的对象时
|
||||
|
||||
1. 最后,在查看更改后,使用 `helm mapkubeapis <release-name> --namespace <release-namespace>` 执行完整运行。
|
||||
|
||||
#### 将 Chart 升级到支持 Kubernetes v1.25 的版本
|
||||
|
||||
清理了具有 PSP 的所有版本后,你就可以继续升级了。对于 Rancher 维护的工作负载,请按照本文档[从 Rancher 维护的应用程序和市场工作负载中删除 PodSecurityPolicies](#从-rancher-维护的应用程序和市场工作负载中删除-podsecuritypolicies) 部分中的步骤进行操作。
|
||||
如果工作负载不是由 Rancher 维护的,请参阅对应的提供商的文档。
|
||||
|
||||
:::caution
|
||||
不要跳过此步骤。与 Kubernetes v1.25 不兼容的应用程序不能保证在清理后正常工作。
|
||||
:::
|
||||
|
||||
## Pod 安全准入配置模板
|
||||
|
||||
Rancher 提供了 PSA 配置模板。它们是可以应用到集群的预定义安全配置。Rancher 管理员(或具有权限的人员)可以[创建、管理和编辑](./psa-config-templates.md) PSA 模板。
|
||||
|
||||
-2
@@ -159,8 +159,6 @@ Kubernetes v1.22 是 Rancher 2.6.3 的实验功能,不支持使用 apiVersion
|
||||
|
||||
使用与第一个集群上使用的相同版本的 Helm 来安装 Rancher:
|
||||
|
||||
对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
```bash
|
||||
helm install rancher rancher-latest/rancher \
|
||||
--namespace cattle-system \
|
||||
|
||||
+1
-10
@@ -240,15 +240,7 @@ Rancher 没有注册的 Kubernetes 集群(除了 RKE2 和 K3s Kubernetes 集
|
||||
|
||||
但是,如果集群具有某种功能(例如使用 pod 安全策略),那么该集群的用户可能仍希望在 Rancher UI 中为集群选择 pod 安全策略。为此,用户需要手动让 Rancher 知道集群已启用 pod 安全策略。
|
||||
|
||||
通过对已注册的集群进行注释,你可以向 Rancher 表明集群在 Rancher 之外被赋予了 Pod 安全策略或其他功能。
|
||||
|
||||
此示例注释表示启用了 pod 安全策略:
|
||||
|
||||
```json
|
||||
"capabilities.cattle.io/pspEnabled": "true"
|
||||
```
|
||||
|
||||
以下注释表示 Ingress 功能。请注意,非原始对象的值需要进行 JSON 编码,并转义引号:
|
||||
通过对已注册的集群进行注释,你可以向 Rancher 表明集群在 Rancher 之外被赋予了 Ingress 功能或其他功能。以下注释表示 Ingress 功能。请注意,非原始对象的值需要进行 JSON 编码,并转义引号:
|
||||
|
||||
```json
|
||||
"capabilities.cattle.io/ingressCapabilities": "[
|
||||
@@ -265,7 +257,6 @@ Rancher 没有注册的 Kubernetes 集群(除了 RKE2 和 K3s Kubernetes 集
|
||||
- `loadBalancerCapabilities`
|
||||
- `nodePoolScalingSupported`
|
||||
- `nodePortRange`
|
||||
- `pspEnabled`
|
||||
- `taintSupport`
|
||||
|
||||
所有功能及其类型定义都可以在 Rancher API 视图中查看,地址是 `[Rancher Server URL]/v3/schemas/capabilities`。
|
||||
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
---
|
||||
title: 添加 Pod 安全策略
|
||||
---
|
||||
|
||||
:::note 先决条件:
|
||||
|
||||
以下选项仅适用于[使用 RKE 启动的集群](../launch-kubernetes-with-rancher/launch-kubernetes-with-rancher.md)。
|
||||
|
||||
:::
|
||||
|
||||
当你的集群上运行了具有安全敏感配置的 pod 时,请为其分配 [pod 安全策略](../authentication-permissions-and-global-configuration/create-pod-security-policies.md),这是一组用于监控 pod 中的状态和设置的规则。如果 pod 不符合你的策略中指定的规则,则该策略会阻止它运行。
|
||||
|
||||
你可以在配置集群时分配 pod 安全策略。如果你以后需要放松或限制 pod 的安全性,你可以在编辑集群时更新策略:
|
||||
|
||||
1. 点击 **☰ > 集群管理**。
|
||||
1. 转到要应用 pod 安全策略的集群,然后单击 **⋮ > 编辑配置**。
|
||||
1. 在 **Pod 安全策略支持**中,选择**启用**。
|
||||
|
||||
:::note
|
||||
|
||||
此选项仅适用于[由 RKE 配置的集群](../launch-kubernetes-with-rancher/launch-kubernetes-with-rancher.md)。
|
||||
|
||||
:::
|
||||
|
||||
4. 从**默认 Pod 安全策略**下拉列表中,选择要应用于集群的策略。
|
||||
|
||||
Rancher 支持了`受限`和`不受限`的[策略](../authentication-permissions-and-global-configuration/create-pod-security-policies.md#默认-psp),你也可以[创建自定义策略](../authentication-permissions-and-global-configuration/create-pod-security-policies.md#创建-psp)。
|
||||
|
||||
5. 单击**保存**。
|
||||
|
||||
**结果**:pod 安全策略应用于集群和集群内的任何项目。
|
||||
|
||||
:::note
|
||||
|
||||
在分配 pod 安全策略之前已经运行的工作负载是不受限制的。即使它们不符合你的 pod 安全策略,在分配策略之前运行的工作负载也会继续运行。
|
||||
|
||||
要检查正在运行的工作负载是否通过了你的 pod 安全策略,请克隆或升级它。
|
||||
|
||||
:::
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
---
|
||||
title: 分配 Pod 安全策略
|
||||
---
|
||||
|
||||
_Pod 安全策略_(PSP)是控制 Pod 安全的规范(如是否可以使用 root 权限等)的对象。
|
||||
|
||||
## 添加默认 Pod 安全策略
|
||||
|
||||
使用 RKE 创建新集群时,你可以将其配置为立即应用 PSP。创建集群时,使用**集群选项**来启用 PSP。分配给集群的 PSP 将是集群内项目的默认 PSP。
|
||||
|
||||
:::note 先决条件:
|
||||
|
||||
在 Rancher 中创建 Pod 安全策略。在将默认 PSP 分配给新集群之前,你必须有一个可分配的 PSP。有关说明,请参阅[创建 Pod 安全策略](../authentication-permissions-and-global-configuration/create-pod-security-policies.md)。
|
||||
|
||||
:::
|
||||
|
||||
:::note
|
||||
|
||||
出于安全考虑,我们建议你在创建集群时分配 PSP。
|
||||
|
||||
:::
|
||||
|
||||
要启用默认 Pod 安全策略,请将 **Pod 安全策略支持**选项设置为**启用**,然后从**默认 Pod 安全策略**下拉框中进行选择。
|
||||
|
||||
集群完成配置后,你选择的 PSP 将应用于集群内的所有项目。
|
||||
+6
-17
@@ -122,12 +122,11 @@ Rancher 在 Kubernetes 之上进行了扩展,除了集群级别之外,还允
|
||||
|
||||
本节介绍如何创建具有名称以及可选 pod 安全策略、成员和资源配额的新项目。
|
||||
|
||||
1. [命名新项目](#1-命名新项目)
|
||||
2. [可选:选择 pod 安全策略](#2-可选选择-pod-安全策略)
|
||||
3. [推荐:添加项目成员](#3-推荐添加项目成员)
|
||||
4. [可选:添加资源配额](#4-可选添加资源配额)
|
||||
1. [命名新项目](#命名新项目)
|
||||
1. [推荐:添加项目成员](#推荐添加项目成员)
|
||||
1. [可选:添加资源配额](#可选添加资源配额)
|
||||
|
||||
### 1. 命名新项目
|
||||
### 命名新项目
|
||||
|
||||
1. 在左上角,单击 **☰ > 集群管理**。
|
||||
1. 在**集群**页面上,转到要在其中创建项目的集群,然后单击 **Explore**。
|
||||
@@ -135,17 +134,7 @@ Rancher 在 Kubernetes 之上进行了扩展,除了集群级别之外,还允
|
||||
1. 单击**创建项目**。
|
||||
1. 输入**项目名称**。
|
||||
|
||||
### 2. 可选:选择 Pod 安全策略
|
||||
|
||||
此选项仅在 Pod 安全策略已创建时可用。有关说明,请参阅[创建 Pod 安全策略](../authentication-permissions-and-global-configuration/create-pod-security-policies.md)。
|
||||
|
||||
将 PSP 分配给项目将:
|
||||
|
||||
- 覆盖集群的默认 PSP。
|
||||
- 将 PSP 应用于项目。
|
||||
- 将 PSP 应用到后续添加到项目中的命名空间。
|
||||
|
||||
### 3. 推荐:添加项目成员
|
||||
### 推荐:添加项目成员
|
||||
|
||||
使用**成员**为其他用户提供项目访问权限和角色。
|
||||
|
||||
@@ -175,7 +164,7 @@ Rancher 在 Kubernetes 之上进行了扩展,除了集群级别之外,还允
|
||||
:::
|
||||
1. 在**项目权限**中选择一个角色。如需更多信息,请参阅[项目角色文档](../authentication-permissions-and-global-configuration/manage-role-based-access-control-rbac/cluster-and-project-roles.md)。
|
||||
|
||||
### 4. 可选:添加资源配额
|
||||
### 可选:添加资源配额
|
||||
|
||||
资源配额用于限制项目(及其命名空间)可以使用的资源。有关详细信息,请参阅[资源配额](../../advanced-user-guides/manage-projects/manage-project-resource-quotas/manage-project-resource-quotas.md)。
|
||||
|
||||
|
||||
-4
@@ -30,10 +30,6 @@ Monitoring 应用设置了 `prometheus.prometheusSpec.ignoreNamespaceSelectors=f
|
||||
|
||||
详情请参阅[本节](selectors-and-scrape-configurations.md)。
|
||||
|
||||
## 在具有 Pod 安全策略的情况下启用 Istio
|
||||
|
||||
详情请参阅[本节](pod-security-policies.md)。
|
||||
|
||||
## 在 RKE2 集群上安装 Istio 的其他步骤
|
||||
|
||||
详情请参阅[本节](install-istio-on-rke2-cluster.md)。
|
||||
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
---
|
||||
title: 在具有 Pod 安全策略的情况下启用 Istio
|
||||
---
|
||||
|
||||
如果你启用了限制性 Pod 安全策略(Pod Security Policy),由于 Istio 需要某些权限才能自行安装和管理 pod 基础设施,因此 Istio 可能无法正常运行。在本文中,我们将配置一个为 Istio 启用了 PSP 的集群,并设置 Istio CNI 插件。
|
||||
|
||||
Istio CNI 插件不再要求每个应用 pod 具有特权 `NET_ADMIN` 容器。如需更多信息,请参阅 [Istio CNI 插件文档](https://istio.io/docs/setup/additional-setup/cni)。请注意,[Istio CNI 插件处于 alpha 阶段](https://istio.io/about/feature-stages/)。
|
||||
|
||||
:::note 先决条件:
|
||||
|
||||
- 集群必须是 RKE Kubernetes 集群。
|
||||
- 必须使用默认 PodSecurityPolicy 创建集群。
|
||||
|
||||
要在使用 Rancher UI 创建 Kubernetes 集群时启用 Pod 安全策略支持,请转到<b>高级选项</b>。在 <b>Pod 安全策略支持</b>中,单击<b>启用</b>,然后选择一个默认的 pod 安全策略。
|
||||
|
||||
:::
|
||||
|
||||
1. [将 PodSecurityPolicy 设置为不受限制](#1-将-podsecuritypolicy-设置为不受限制)
|
||||
2. [启用 CNI](#2-启用-cni)
|
||||
3. [验证 CNI 是否正常工作](#3-验证-cni-是否正常工作)
|
||||
|
||||
## 1. 将 PodSecurityPolicy 设置为不受限制
|
||||
|
||||
不受限制的 PSP 支持安装 Istio。
|
||||
|
||||
在安装 Istio 的项目或计划安装 Istio 的项目中,将 PSP 设置为 `unrestricted`。
|
||||
|
||||
1. 点击 **☰ > 集群管理**。
|
||||
1. 选择你创建的集群,并点击 **Explore**。
|
||||
1. 单击**集群 > 项目/命名空间**。
|
||||
1. 找到**项目: System**,然后选择 **⋮ > 编辑配置**。
|
||||
1. 将 Pod 安全策略选项更改为不受限制,然后单击**保存**。
|
||||
|
||||
## 2. 启用 CNI
|
||||
|
||||
通过 **Apps** 安装或升级 Istio 时:
|
||||
|
||||
1. 单击**组件**。
|
||||
2. 选中**启用 CNI**旁边的框。
|
||||
3. 完成 Istio 的安装或升级。
|
||||
|
||||
你也可以通过编辑 `values.yaml` 来启用 CNI:
|
||||
|
||||
```
|
||||
istio_cni.enabled: true
|
||||
```
|
||||
|
||||
在集群中启用 CNI 后,Istio 应该能成功安装。
|
||||
|
||||
## 3. 验证 CNI 是否正常工作
|
||||
|
||||
通过部署[示例应用](https://istio.io/latest/docs/examples/bookinfo/)或部署你自己的应用,来验证 CNI 是否正常工作。
|
||||
|
||||
-6
@@ -145,12 +145,6 @@ Rancher v2.6 引入了[为 RKE 集群配置 ECR 镜像仓库](https://rancher.co
|
||||
|
||||
每个能够使用 RKE 启动集群的云提供商都可以收集指标并监控你的集群节点。如果启用此选项,你可以从你的云提供商门户查看你的节点指标。
|
||||
|
||||
### Pod 安全策略支持
|
||||
|
||||
为集群启用 [pod 安全策略](../../../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md)。启用此选项后,使用**默认 Pod 安全策略**下拉菜单选择一个策略。
|
||||
|
||||
你必须有已配置的 Pod 安全策略才能使用此选项。
|
||||
|
||||
### 节点上的 Docker 版本
|
||||
|
||||
表示是否允许节点运行 Rancher 不正式支持的 Docker 版本。
|
||||
|
||||
-4
@@ -124,10 +124,6 @@ Rancher 与以下开箱即用的网络提供商兼容:
|
||||
|
||||
:::
|
||||
|
||||
#### 默认 Pod 安全策略
|
||||
|
||||
为集群选择默认的 [pod 安全策略](../../../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md)。请参阅 [RKE2 文档](https://docs.rke2.io/security/pod_security_policies)来了解每个可用策略的规范。
|
||||
|
||||
#### Worker CIS 配置文件
|
||||
|
||||
选择一个 [CIS benchmark](../../../how-to-guides/advanced-user-guides/cis-scan-guides/cis-scan-guides.md) 来验证系统配置。
|
||||
|
||||
+2
-8
@@ -26,27 +26,21 @@ Rancher 使用以下 Kubernetes 发行版:
|
||||
|
||||
| Kubernetes 版本 | CIS Benchmark 版本 | 自我评估指南 | 加固指南 |
|
||||
|--------------------|-----------------------|-----------------------|------------------|
|
||||
| Kubernetes v1.23 | CIS v1.23 | [链接](rke1-hardening-guide/rke1-self-assessment-guide-with-cis-v1.23-k8s-v1.23.md) | [链接](rke1-hardening-guide/rke1-hardening-guide.md) |
|
||||
| Kubernetes v1.24 | CIS v1.24 | [链接](rke1-hardening-guide/rke1-self-assessment-guide-with-cis-v1.24-k8s-v1.24.md) | [链接](rke1-hardening-guide/rke1-hardening-guide.md) |
|
||||
| Kubernetes v1.25/v1.26/v1.27 | CIS v1.7 | [链接](rke1-hardening-guide/rke1-self-assessment-guide-with-cis-v1.7-k8s-v1.25-v1.26-v1.27.md) | [链接](rke1-hardening-guide/rke1-hardening-guide.md) |
|
||||
|
||||
### RKE2 指南
|
||||
|
||||
| 类型 | Kubernetes 版本 | CIS Benchmark 版本 | 自我评估指南 | 加固指南 |
|
||||
|------|--------------------|-----------------------|-----------------------|------------------|
|
||||
| Rancher provisioned RKE2 | Kubernetes v1.23 | CIS v1.23 | [链接](rke2-hardening-guide/rke2-self-assessment-guide-with-cis-v1.23-k8s-v1.23.md) | [链接](rke2-hardening-guide/rke2-hardening-guide.md) |
|
||||
| Rancher provisioned RKE2 | Kubernetes v1.24 | CIS v1.24 | [链接](rke2-hardening-guide/rke2-self-assessment-guide-with-cis-v1.24-k8s-v1.24.md) | [链接](rke2-hardening-guide/rke2-hardening-guide.md) |
|
||||
| Rancher provisioned RKE2 | Kubernetes v1.25/v1.26/v1.27 | CIS v1.7 | [链接](rke2-hardening-guide/rke2-self-assessment-guide-with-cis-v1.7-k8s-v1.25-v1.26-v1.27.md) | [链接](rke2-hardening-guide/rke2-hardening-guide.md) |
|
||||
| Standalone RKE2 | Kubernetes v1.25/v1.26/v1.27 | CIS v1.7 | [链接](https://docs.rke2.io/security/cis_self_assessment123) | [链接](https://docs.rke2.io/security/hardening_guide) |
|
||||
| Standalone RKE2 | Kubernetes v1.27-v1.32 | CIS v1.9 | [链接](https://docs.rke2.io/security/cis_self_assessment19) | [链接](https://docs.rke2.io/security/hardening_guide) |
|
||||
|
||||
### K3s 指南
|
||||
|
||||
| 类型 | Kubernetes 版本 | CIS Benchmark 版本 | 自我评估指南 | 加固指南 |
|
||||
|------|--------------------|-----------------------|-----------------------|------------------|
|
||||
| Rancher provisioned K3s cluster | Kubernetes v1.23 | CIS v1.23 | [链接](k3s-hardening-guide/k3s-self-assessment-guide-with-cis-v1.23-k8s-v1.23.md) | [链接](k3s-hardening-guide/k3s-hardening-guide.md) |
|
||||
| Rancher provisioned K3s cluster | Kubernetes v1.24 | CIS v1.24 | [链接](k3s-hardening-guide/k3s-self-assessment-guide-with-cis-v1.24-k8s-v1.24.md) | [链接](k3s-hardening-guide/k3s-hardening-guide.md) |
|
||||
| Rancher provisioned K3s cluster | Kubernetes v1.25/v1.26/v1.27 | CIS v1.7 | [链接](k3s-hardening-guide/k3s-self-assessment-guide-with-cis-v1.7-k8s-v1.25-v1.26-v1.27.md) | [链接](k3s-hardening-guide/k3s-hardening-guide.md) |
|
||||
| Standalone K3s | Kubernetes v1.22 up to v1.24 | CIS v1.23 | [链接](https://docs.k3s.io/security/self-assessment-1.8) | [链接](https://docs.k3s.io/security/hardening-guide) |
|
||||
| Standalone K3s | Kubernetes v1.26 up to v1.29 | CIS v1.8 | [链接](https://docs.k3s.io/security/self-assessment-1.8) | [链接](https://docs.k3s.io/security/hardening-guide) |
|
||||
|
||||
## 在 SELinux 上使用 Rancher
|
||||
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ kernel.panic_on_oops=1
|
||||
|
||||
## Kubernetes 运行时要求
|
||||
|
||||
CIS Benchmark 的运行时要求主要围绕 Pod 安全(通过 PSP 或 PSA)、网络策略和 API 服务器审计日志展开。
|
||||
CIS Benchmark 的运行时要求主要围绕 Pod 安全(通过 PSA)、网络策略和 API 服务器审计日志展开。
|
||||
|
||||
默认情况下,K3s 不包含任何 Pod 安全或网络策略。然而,K3s 附带一个控制器,可以强制执行你创建的任何网络策略。默认情况下,K3s 启用了 `PodSecurity` 和 `NodeRestriction` 等多个准入控制器。
|
||||
|
||||
|
||||
-3152
File diff suppressed because it is too large
Load Diff
-3208
File diff suppressed because it is too large
Load Diff
-1
@@ -155,7 +155,6 @@ done
|
||||
## 已知限制
|
||||
|
||||
- 当注册自定义节点仅提供公共 IP 时,Rancher **exec shell** 和 **查看 pod 日志** 在加固设置中**不起作用**。 此功能需要在注册自定义节点时提供私有 IP。
|
||||
- 当根据 Rancher [提供](../../../../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md)的 Pod 安全策略 (Pod Security Policies, PSP) 将 `default_pod_security_policy_template_id:` 设置为 `restricted` 或 `restricted-noroot` 时,Rancher 会在 `default` service accounts 上创建 `RoleBindings` 和 `ClusterRoleBindings`。CIS 检查 5.1.5 要求除了默认角色之外,`default` service accounts 不应绑定其他角色或集群角色。此外,`default` service accounts 应配置为不提供服务账户令牌,也不具有任何明确的权限分配。
|
||||
|
||||
## 加固的 RKE `cluster.yml` 配置参考
|
||||
|
||||
|
||||
-3089
File diff suppressed because one or more lines are too long
-3048
File diff suppressed because it is too large
Load Diff
-3200
File diff suppressed because one or more lines are too long
-3202
File diff suppressed because one or more lines are too long
-1
@@ -12,7 +12,6 @@
|
||||
| [轮换证书](../how-to-guides/new-user-guides/manage-clusters/rotate-certificates.md) | ✓ | ✓ | | |
|
||||
| [备份](../how-to-guides/new-user-guides/backup-restore-and-disaster-recovery/back-up-rancher-launched-kubernetes-clusters.md)和[恢复](../how-to-guides/new-user-guides/backup-restore-and-disaster-recovery/restore-rancher-launched-kubernetes-clusters-from-backup.md) Rancher 启动的集群 | ✓ | ✓ | | ✓<sup>4</sup> |
|
||||
| [在 Rancher 无法访问集群时清理 Kubernetes 组件](../how-to-guides/new-user-guides/manage-clusters/clean-cluster-nodes.md) | ✓ | | | |
|
||||
| [配置 Pod 安全策略](../how-to-guides/new-user-guides/manage-clusters/add-a-pod-security-policy.md) | ✓ | ✓ | |
|
||||
|
||||
1. 注册的 EKS、GKE 和 AKS 集群与从 Rancher UI 创建的 EKS、GKE 和 AKS 集群的可用选项一致。不同之处是,从 Rancher UI 中删除已注册的集群后,集群不会被销毁。
|
||||
|
||||
|
||||
-3
@@ -194,7 +194,6 @@ cert-manager-webhook-787858fcdb-nlzsq 1/1 Running 0 2m
|
||||
- 将 `hostname` 设置为解析到你的负载均衡器的 DNS 名称。
|
||||
- 将 `bootstrapPassword` 设置为 `admin` 用户独有的值。
|
||||
- 如果你需要安装指定的 Rancher 版本,使用 `--version` 标志,例如 `--version 2.7.0`。
|
||||
- 对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
```
|
||||
helm install rancher rancher-<CHART_REPO>/rancher \
|
||||
@@ -235,7 +234,6 @@ deployment "rancher" successfully rolled out
|
||||
- 将 `ingress.tls.source` 设置为 `letsEncrypt`。
|
||||
- 将 `letsEncrypt.email` 设置为可通讯的电子邮件地址,用于发送通知(例如证书到期的通知)。
|
||||
- 将 `letsEncrypt.ingress.class` 设为你的 Ingress Controller(例如 `traefik`,`nginx`,`haproxy`)
|
||||
- 对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
```
|
||||
helm install rancher rancher-<CHART_REPO>/rancher \
|
||||
@@ -278,7 +276,6 @@ deployment "rancher" successfully rolled out
|
||||
- 设置 `hostname`。
|
||||
- 将 `bootstrapPassword` 设置为 `admin` 用户独有的值。
|
||||
- 将 `ingress.tls.source` 设置为 `secret`。
|
||||
- 对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
```
|
||||
helm install rancher rancher-<CHART_REPO>/rancher \
|
||||
|
||||
-68
@@ -1,68 +0,0 @@
|
||||
---
|
||||
title: 将加固的自定义/导入集群升级到 Kubernetes v1.25
|
||||
---
|
||||
|
||||
Kubernetes v1.25 改变了集群描述和执行安全策略的方式。从这个版本开始,[Pod 安全策略 (PSP)](https://kubernetes.io/docs/concepts/security/pod-security-policy/)不再可用。Kubernetes v1.25 将它们替换为新的安全对象:[Pod 安全标准 (PSS)](https://kubernetes.io/docs/concepts/security/pod-security-standards/) 和 [Pod 安全准入 (PSA)](https://kubernetes.io/docs/concepts/security/pod-security-admission/)。
|
||||
|
||||
如果你具有自定义或导入的加固集群,你需要做好准备,确保将旧版本的 Kubernetes 顺利升级到 v1.25 或更高版本。
|
||||
|
||||
:::note
|
||||
|
||||
升级到 v1.25 后,添加必要的 Rancher 命名空间豁免。有关详细信息,请参阅 [Pod 安全准入 (PSA) 配置模板](../../../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/psa-config-templates.md#豁免必须的-rancher-命名空间)。
|
||||
|
||||
:::
|
||||
|
||||
## 将导入的加固集群升级到 Kubernetes v1.25 或更高版本
|
||||
|
||||
<Tabs groupId="k8s-distro">
|
||||
<TabItem value="RKE2" default>
|
||||
|
||||
在集群中的每个节点上执行以下操作:
|
||||
1. 将 [`rancher-psact.yaml`](./rancher-psact.yaml) 保存到 `/etc/rancher/rke2` 中。
|
||||
1. 编辑 RKE2 配置文件:
|
||||
1. 将 `profile` 字段更新为 `cis-1.23`。
|
||||
1. 指定刚才添加的配置文件的路径:`pod-security-admission-config-file: /etc/rancher/rke2/rancher-psact.yaml`。
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="K3s">
|
||||
|
||||
在集群中的每个节点上执行以下操作:
|
||||
|
||||
遵循 K3s [将加固集群从 v1.24.x 升级到 v1.25.x](https://docs.k3s.io/known-issues#hardened-125)的官方说明,但使用[自定义](./rancher-psact.yaml)Rancher PSA 配置模板,而不是 K3s 官方网站上提供的配置。
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
执行这些步骤后,你可以通过 Rancher UI 升级集群的 Kubernetes 版本:
|
||||
|
||||
1. 在左上角,单击 **☰ > 集群管理**。
|
||||
1. 在**集群**表中找到要更新的集群,点击 **⋮**。
|
||||
1. 选择**编辑配置**。
|
||||
1. 在 **Kubernetes 版本**下拉菜单中,选择要使用的版本。
|
||||
1. 单击**保存**。
|
||||
|
||||
## 将自定义加固集群升级到 Kubernetes v1.25 或更高版本
|
||||
|
||||
<Tabs groupId="k8s-distro">
|
||||
<TabItem value="RKE2" default>
|
||||
|
||||
1. 在左上角,单击 **☰ > 集群管理**。
|
||||
1. 在**集群**表中找到要更新的集群,点击 **⋮**。
|
||||
1. 选择**编辑配置**。
|
||||
1. 在**基本信息 > 安全**下的 **CIS 配置文件**下拉菜单中,选择 `cis-1.23`。
|
||||
1. 在 **PSA 配置模板**下拉菜单中,选择 `rancher-restricted`。
|
||||
1. 在 **Kubernetes 版本**下拉菜单中,选择要使用的版本。
|
||||
1. 单击**保存**。
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="K3s">
|
||||
|
||||
1. 在左上角,单击 **☰ > 集群管理**。
|
||||
1. 在**集群**表中找到要更新的集群,点击 **⋮**。
|
||||
1. 选择**编辑 YAML**。
|
||||
1. 从 `kube-apiserver-arg.enable-admission-plugins` 中删除 `PodSecurityPolicy`。
|
||||
1. 在 `spec` 字段中,添加一行:`defaultPodSecurityAdmissionConfigurationTemplateName: rancher-restricted`
|
||||
1. 将 `kubernetesVersion` 更新为你选择的版本(v1.25 或更高版本)。
|
||||
1. 单击**保存**。
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
-4
@@ -149,8 +149,6 @@ hostname: rancher.my.org
|
||||
|
||||
将上一步中的所有值用 `--set key=value` 追加到命令中。
|
||||
|
||||
对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
```
|
||||
helm upgrade rancher rancher-<CHART_REPO>/rancher \
|
||||
--namespace cattle-system \
|
||||
@@ -183,8 +181,6 @@ helm upgrade rancher-stable rancher-<CHART_REPO>/rancher \
|
||||
```
|
||||
1. 只更新 Rancher 版本:
|
||||
|
||||
对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
```
|
||||
helm upgrade rancher rancher-<CHART_REPO>/rancher \
|
||||
--namespace cattle-system \
|
||||
|
||||
-2
@@ -58,8 +58,6 @@ keywords: [rancher helm chart, rancher helm 选项, rancher helm chart 选项, h
|
||||
| `systemDefaultRegistry` | "" | `string` - 用于所有系统容器镜像的私有仓库,例如 http://registry.example.com/ |
|
||||
| `tls` | "ingress" | `string` - 详情请参见[外部 TLS 终止](#外部-tls-终止)。- "ingress, external" |
|
||||
| `useBundledSystemChart` | `false` | `bool` - 选择 Rancher Server 打包的 system-charts。此参数用于离线环境安装。 |
|
||||
| `global.cattle.psp.enabled` | `true` | `bool` - 使用 Rancher v2.7.2-v2.7.4 时,选择 `false` 以禁用 Kubernetes v1.25 及更高版本的 PSP。使用 Rancher v2.7.5 及更高版本时,Rancher 会尝试检测集群是否运行不支持 PSP 的 Kubernetes 版本,如果确定集群不支持 PSP,则将默认 PSP 的使用设置为 false。你仍然可以通过显式提供此值的 `true` 或 `false` 来手动覆盖此值。在支持 PSP 的集群中(例如使用 Kubernetes v1.24 或更低版本的集群),Rancher 仍将默认使用 PSP。 |
|
||||
|
||||
|
||||
### 引导密码
|
||||
|
||||
|
||||
-4
@@ -168,8 +168,6 @@ kubectl create namespace cattle-system
|
||||
|
||||
然后安装 Rancher,并声明你选择的选项。参考下表来替换每个占位符。Rancher 需要配置为使用私有镜像仓库,以便配置所有 Rancher 启动的 Kubernetes 集群或 Rancher 工具。
|
||||
|
||||
对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
| 占位符 | 描述 |
|
||||
------------|-------------
|
||||
| `<VERSION>` | 输出压缩包的版本号。 |
|
||||
@@ -199,8 +197,6 @@ kubectl create namespace cattle-system
|
||||
|
||||
安装 Rancher,并声明你选择的选项。参考下表来替换每个占位符。Rancher 需要配置为使用私有镜像仓库,以便配置所有 Rancher 启动的 Kubernetes 集群或 Rancher 工具。
|
||||
|
||||
对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
| 占位符 | 描述 |
|
||||
| -------------------------------- | ----------------------------------------------- |
|
||||
| `<VERSION>` | 输出压缩包的版本号。 |
|
||||
|
||||
@@ -31,7 +31,7 @@ Rancher API Server 是基于嵌入式 Kubernetes API Server 和 etcd 数据库
|
||||
### 授权和基于角色的权限控制(RBAC)
|
||||
|
||||
- **用户管理**:Rancher API Server 除了管理本地用户,还[管理用户用来访问外部服务所需的认证信息](../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/authentication-config/authentication-config.md),如登录 Active Directory 和 GitHub 所需的账号密码。
|
||||
- **授权**:Rancher API Server 可以管理[访问控制策略](../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/manage-role-based-access-control-rbac/manage-role-based-access-control-rbac.md)和[安全策略](../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md)。
|
||||
- **授权**:Rancher API Server 可以管理[访问控制策略](../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/manage-role-based-access-control-rbac/manage-role-based-access-control-rbac.md)和[安全标准](../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/pod-security-standards.md)。
|
||||
|
||||
### 使用 Kubernetes 的功能
|
||||
|
||||
|
||||
-2
@@ -124,8 +124,6 @@ helm install cert-manager jetstack/cert-manager `
|
||||
|
||||
要安装特定的 Rancher 版本,请使用 `--version` 标志(例如,`--version 2.6.6`)。否则,默认安装最新的 Rancher。请参阅[选择 Rancher 版本](../../installation-and-upgrade/resources/choose-a-rancher-version.md)。
|
||||
|
||||
对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
请注意,密码至少需要 12 个字符。
|
||||
|
||||
```
|
||||
|
||||
-6
@@ -9,9 +9,3 @@ title: 安装 Rancher CIS Benchmark
|
||||
1. 单击**安装**。
|
||||
|
||||
**结果**:CIS 扫描应用已经部署在 Kubernetes 集群上。
|
||||
|
||||
:::note
|
||||
|
||||
如果你使用 Kubernetes v1.24 或更早版本,并且具有使用 [Pod 安全策略](../../new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md) (PSP) 加固的集群,则 CIS Benchmark 4.0.0 及更高版本会默认禁用 PSP。要在 PSP 加固集群上安装 CIS Benchmark,请在安装 Chart 之前将 values 中的 `global.psp.enabled` 设置为 `true`。[Pod 安全准入](../../new-user-guides/authentication-permissions-and-global-configuration/pod-security-standards.md) (PSA) 加固集群不受影响。
|
||||
|
||||
:::
|
||||
|
||||
-2
@@ -39,8 +39,6 @@ Rancher 包含一些默认关闭的实验功能。在某些情况下,例如当
|
||||
|
||||
使用 Helm Chart 安装 Rancher 时,使用 `--set` 选项。下面的示例通过传递功能开关名称(用逗号分隔)来启用两个功能:
|
||||
|
||||
对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
```
|
||||
helm install rancher rancher-latest/rancher \
|
||||
--namespace cattle-system \
|
||||
|
||||
-1
@@ -5,7 +5,6 @@ title: 1. 在集群中启用 Istio
|
||||
:::note 先决条件:
|
||||
|
||||
- 只有分配了 `cluster-admin` [Kubernetes 默认角色](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles)的用户可以在 Kubernetes 集群中配置和安装 Istio。
|
||||
- 如果你有 pod 安全策略,则需要安装启用了 CNI 的 Istio。有关详细信息,请参阅[本节](../../../integrations-in-rancher/istio/configuration-options/pod-security-policies.md)。
|
||||
- 要在 RKE2 集群上安装 Istio,则需要执行额外的步骤。有关详细信息,请参阅[本节](../../../integrations-in-rancher/istio/configuration-options/install-istio-on-rke2-cluster.md)。
|
||||
- 要在启用了项目网络隔离的集群中安装 Istio,则需要执行额外的步骤。有关详细信息,请参阅[本节](../../../integrations-in-rancher/istio/configuration-options/project-network-isolation.md)。
|
||||
|
||||
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
---
|
||||
title: Pod 安全策略
|
||||
---
|
||||
|
||||
:::note
|
||||
|
||||
本文介绍的集群选项仅适用于 [Rancher 已在其中启动 Kubernetes 的集群](../../new-user-guides/launch-kubernetes-with-rancher/launch-kubernetes-with-rancher.md)。
|
||||
|
||||
:::
|
||||
|
||||
你可以在创建项目的时候设置 Pod 安全策略(PSP)。如果在创建项目期间没有为项目分配 PSP,你也随时可以将 PSP 分配给现有项目。
|
||||
|
||||
## 先决条件
|
||||
|
||||
- 在 Rancher 中创建 Pod 安全策略。在将默认 PSP 分配给现有项目之前,你必须有一个可分配的 PSP。有关说明,请参阅[创建 Pod 安全策略](../../new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md)。
|
||||
- 将默认 Pod 安全策略分配给项目所属的集群。如果 PSP 还没有应用到集群,你无法将 PSP 分配给项目。有关详细信息,请参阅[将 pod 安全策略添加到集群](../../new-user-guides/manage-clusters/add-a-pod-security-policy.md)。
|
||||
|
||||
## 应用 Pod 安全策略
|
||||
|
||||
1. 在左上角,单击 **☰ > 集群管理**。
|
||||
1. 在**集群**页面上,转到需要移动命名空间的集群,然后单击 **Explore**。
|
||||
1. 单击**集群 > 项目/命名空间**。
|
||||
1. 找到要添加 PSP 的项目。在该项目中选择 **⋮ > 编辑配置**。
|
||||
1. 从 **Pod 安全策略**下拉列表中,选择要应用于项目的 PSP。
|
||||
将 PSP 分配给项目将:
|
||||
|
||||
- 覆盖集群的默认 PSP。
|
||||
- 将 PSP 应用于项目。
|
||||
- 将 PSP 应用到后续添加到项目中的命名空间。
|
||||
|
||||
1. 单击**保存**。
|
||||
|
||||
**结果**:已将 PSP 应用到项目以及项目内的命名空间。
|
||||
|
||||
:::note
|
||||
|
||||
对于在分配 PSP 之前已经在集群或项目中运行工作负载,Rancher 不会检查它们是否符合 PSP。你需要克隆或升级工作负载以查看它们是否通过 PSP。
|
||||
|
||||
:::
|
||||
-1
@@ -24,7 +24,6 @@ _项目_ 是 Rancher 中引入的对象,可帮助你更有组织地管理 Kube
|
||||
- [设置资源配额](manage-project-resource-quotas/manage-project-resource-quotas.md)
|
||||
- [管理命名空间](../../new-user-guides/manage-namespaces.md)
|
||||
- [配置工具](../../../reference-guides/rancher-project-tools.md)
|
||||
- [配置 Pod 安全策略](manage-pod-security-policies.md)
|
||||
|
||||
## 授权
|
||||
|
||||
|
||||
-7
@@ -29,13 +29,6 @@ Rancher 为 Kubernetes 增加了一项关键特性是集中式的用户认证。
|
||||
在 Rancher 中,每个人都是以 _用户_ 的身份进行鉴权,这是一个授予你访问 Rancher 的登录身份。用户登录 Rancher 后,他们的 _授权_ 或者他们在系统中的访问权限由用户的角色决定。Rancher 提供了内置的角色,允许你你轻松地配置用户对资源的权限,但是 Rancher 还提供了为每个 Kubernetes 资源自定义角色的功能。
|
||||
|
||||
更多关于授权的工作原理以及自定义角色的使用,请参考 [RBAC](manage-role-based-access-control-rbac/manage-role-based-access-control-rbac.md)。
|
||||
|
||||
## Pod 安全策略
|
||||
|
||||
_Pod 安全策略_ (或 PSPs) 是控制 Pod 安全敏感方面规范的对象,例如 root 权限。如果一个 Pod 不满足 PSP 中指定的条件,Kubernetes 将不允许 Pod 启动,同时 Rancher 会显示一条错误信息。
|
||||
|
||||
更多关于如何创建和使用 PSPs 的内容,请参考 [Pod 安全策略](create-pod-security-policies.md)。
|
||||
|
||||
## Provisioning Drivers
|
||||
|
||||
Rancher 中的驱动允许你管理哪些程序可以预置[托管的 Kubernetes 集群](../kubernetes-clusters-in-rancher-setup/set-up-clusters-from-hosted-kubernetes-providers/set-up-clusters-from-hosted-kubernetes-providers.md) 或 [云服务器节点](../launch-kubernetes-with-rancher/use-new-nodes-in-an-infra-provider/use-new-nodes-in-an-infra-provider.md),允许 Rancher 部署和管理 Kubernetes。
|
||||
|
||||
-78
@@ -1,78 +0,0 @@
|
||||
---
|
||||
title: Pod 安全策略
|
||||
---
|
||||
|
||||
:::caution
|
||||
Pod 安全策略仅在 Kubernetes v1.24 之前可用。[Pod 安全标准](pod-security-standards.md) 是内置的替代方案。
|
||||
:::
|
||||
|
||||
[Pod 安全策略(PSP)](https://kubernetes.io/docs/concepts/security/pod-security-policy/)是用来控制安全敏感相关 Pod 规范(例如 root 特权)的对象。
|
||||
|
||||
如果某个 Pod 不满足 PSP 指定的条件,Kubernetes 将不允许它启动,Rancher 中将显示错误消息 `Pod <NAME> is forbidden: unable to validate...`。
|
||||
|
||||
|
||||
## PSP 工作原理
|
||||
|
||||
你可以在集群或项目级别分配 PSP。
|
||||
|
||||
PSP 通过继承的方式工作:
|
||||
|
||||
- 默认情况下,分配给集群的 PSP 由其项目以及添加到这些项目的任何命名空间继承。
|
||||
- **例外**:无论 PSP 是分配给集群还是项目,未分配给项目的命名空间不会继承 PSP。因为这些命名空间没有 PSP,所以这些命名空间的工作负载 deployment 将失败,这是 Kubernetes 的默认行为。
|
||||
- 你可以通过将不同的 PSP 直接分配给项目来覆盖默认 PSP。
|
||||
|
||||
在分配 PSP 之前已经在集群或项目中运行的任何工作负载如果符合 PSP,则不会被检查。你需要克隆或升级工作负载以查看它们是否通过 PSP。
|
||||
|
||||
在 [Kubernetes 文档](https://kubernetes.io/docs/concepts/policy/pod-security-policy/)中阅读有关 Pod 安全策略的更多信息。
|
||||
|
||||
## 默认 PSP
|
||||
|
||||
Rancher 内置了三个默认 Pod 安全策略 (PSP),分别是 `restricted-noroot`(受限 noroot),`restricted`(受限)和 `unrestricted`(不受限)策略。
|
||||
|
||||
### 受限-NoRoot
|
||||
|
||||
此策略基于 Kubernetes [示例受限策略](https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/policy/restricted-psp.yaml)。它极大地限制了可以将哪些类型的 Pod 部署到集群或项目中。这项策略:
|
||||
|
||||
- 阻止 Pod 以特权用户身份运行,并防止特权升级。
|
||||
- 验证服务器所需的安全机制是否到位,例如限制哪些卷只能挂载到核心卷类型,并防止添加 root 补充组。
|
||||
|
||||
### 受限
|
||||
|
||||
该策略是宽松版的 `restricted-noroot` 策略,除了允许以特权用户身份运行容器外,几乎所有限制都到位。
|
||||
|
||||
### 不受限
|
||||
|
||||
该策略等效于在禁用 PSP 控制器的情况下运行 Kubernetes。对于可以将哪些 Pod 部署到集群或项目中,它没有任何限制。
|
||||
|
||||
:::note 重要提示:
|
||||
|
||||
禁用 PSP 时,默认 PSP **不会**自动从集群中删除。如果不再需要它们,你必须手动删除它们。
|
||||
|
||||
:::
|
||||
|
||||
## 创建 PSP
|
||||
|
||||
使用 Rancher,你可以使用我们的 GUI 创建 Pod 安全策略,而不是创建 YAML 文件。
|
||||
|
||||
### 要求
|
||||
|
||||
Rancher 只能为[使用 RKE 启动的集群](../launch-kubernetes-with-rancher/launch-kubernetes-with-rancher.md)分配 PSP。
|
||||
|
||||
你必须先在集群级别启用 PSP,然后才能将它们分配给项目。这可以通过[编辑集群](../../../reference-guides/cluster-configuration/cluster-configuration.md)来配置。
|
||||
|
||||
最好的做法是在集群级别设置 PSP。
|
||||
|
||||
我们建议在集群和项目创建期间添加 PSP,而不是将其添加到现有的项目或集群中。
|
||||
|
||||
### 在 Rancher UI 中创建 PSP
|
||||
|
||||
1. 在左上角,单击 **☰ > 集群管理**。
|
||||
1. 在左侧导航栏中,单击 **Pod 安全策略**。
|
||||
1. 单击**添加策略**。
|
||||
1. 为策略命名。
|
||||
1. 填写表格的每个部分。请参阅 [Kubernetes 文档](https://kubernetes.io/docs/concepts/policy/pod-security-policy/),了解每个策略的作用。
|
||||
1. 单击**创建**。
|
||||
|
||||
## 配置
|
||||
|
||||
关于 PSP 的 Kubernetes 文档,请参阅[这里](https://kubernetes.io/docs/concepts/policy/pod-security-policy/)。
|
||||
-49
@@ -15,46 +15,6 @@ PSS 定义了工作负载的安全级别。PSA 描述了 Pod 安全上下文和
|
||||
必须在删除 PodSecurityPolicy 对象_之前_添加新的策略执行机制。否则,你可能会为集群内的特权升级攻击创造机会。
|
||||
:::
|
||||
|
||||
### 从 Rancher 维护的应用程序和市场工作负载中删除 PodSecurityPolicies
|
||||
|
||||
Rancher v2.7.2 提供了 Rancher 维护的 Helm Chart 的新主要版本。v102.x.y 允许你删除与以前的 Chart 版本一起安装的 PSP。这个新版本使用标准化的 `global.cattle.psp.enabled` 开关(默认关闭)替换了非标准的 PSP 开关。
|
||||
|
||||
你必须在_仍使用 Kubernetes v1.24_ 时执行以下步骤:
|
||||
1. 根据需要配置 PSA 控制器。你可以使用 Rancher 的内置 [PSA 配置模板](#pod-安全准入配置模板),或创建自定义模板并将其应用于正在迁移的集群。
|
||||
|
||||
1. 将活动的 PSP 映射到 Pod 安全标准:
|
||||
1. 查看集群中哪些 PSP 仍处于活动状态:
|
||||
:::caution
|
||||
此策略可能会错过当前未运行的工作负载,例如 CronJobs、当前缩放为零的工作负载或尚未推出的工作负载。
|
||||
:::
|
||||
|
||||
```shell
|
||||
kubectl get pods \
|
||||
--all-namespaces \
|
||||
--output jsonpath='{.items[*].metadata.annotations.kubernetes\.io\/psp}' \
|
||||
| tr " " "\n" | sort -u
|
||||
```
|
||||
|
||||
1. 按照[将 PSP 映射到 Pod 安全标准](https://kubernetes.io/docs/reference/access-authn-authz/psp-to-pod-security-standards/)的 Kubernetes 指南将 PSS 应用于依赖 PSP 的工作负载。有关详细信息,请参阅[从 PodSecurityPolicy 迁移到内置 PodSecurity Admission 控制器](https://kubernetes.io/docs/tasks/configure-pod-container/migrate-from-psp/)。
|
||||
|
||||
1. 要从 Rancher Chart 中删除 PSP,请在升级到 Kubernetes v1.25 _之前_将 Chart 升级到最新的 v102.x.y 版本。确保 **Enable PodSecurityPolicies** 选项**已禁用**。这将删除与以前的 Chart 版本一起安装的所有 PSP。
|
||||
|
||||
:::info 重要提示
|
||||
如果你想将 Chart 升级到 v102.x.y,但不打算将集群升级到 Kubernetes v1.25 和弃用 PSP,请确保为每个要升级的 Chart 选择 **Enable PodSecurityPolicies** 选项。
|
||||
:::
|
||||
|
||||
### 在 Kubernetes v1.25 升级后清理版本
|
||||
|
||||
如果你在删除 Chart 的 PSP 时遇到问题,或者 Chart 不包含用于删除 PSP 的内置机制,Chart 升级或删除可能会失败并显示如下错误消息:
|
||||
```console
|
||||
Error: UPGRADE FAILED: resource mapping not found for name: "<object-name>" namespace: "<object-namespace>" from "": no matches for kind "PodSecurityPolicy" in version "policy/v1beta1"
|
||||
ensure CRDs are installed first
|
||||
```
|
||||
|
||||
Helm 尝试在集群中查询存储在先前版本的数据 blob 中的对象时,就会发生这种情况。要清理这些版本并避免此错误,请使用 `helm-mapkubeapis` Helm 插件。要详细了解 `helm-mapkubeapis`、它的工作原理以及如何针对你的用例进行微调,请参阅 [Helm 官方文档](https://github.com/helm/helm-mapkubeapis#readme)。
|
||||
|
||||
请注意,Helm 插件安装在你运行命令的机器本地。因此,请确保从同一台机器运行安装和清理。
|
||||
|
||||
#### 安装 `helm-mapkubeapis`
|
||||
|
||||
1. 在打算使用 `helm-mapkubeapis` 的机器上打开你的终端并安装插件:
|
||||
@@ -106,15 +66,6 @@ Helm 尝试在集群中查询存储在先前版本的数据 blob 中的对象时
|
||||
|
||||
1. 最后,在查看更改后,使用 `helm mapkubeapis <release-name> --namespace <release-namespace>` 执行完整运行。
|
||||
|
||||
#### 将 Chart 升级到支持 Kubernetes v1.25 的版本
|
||||
|
||||
清理了具有 PSP 的所有版本后,你就可以继续升级了。对于 Rancher 维护的工作负载,请按照本文档[从 Rancher 维护的应用程序和市场工作负载中删除 PodSecurityPolicies](#从-rancher-维护的应用程序和市场工作负载中删除-podsecuritypolicies) 部分中的步骤进行操作。
|
||||
如果工作负载不是由 Rancher 维护的,请参阅对应的提供商的文档。
|
||||
|
||||
:::caution
|
||||
不要跳过此步骤。与 Kubernetes v1.25 不兼容的应用程序不能保证在清理后正常工作。
|
||||
:::
|
||||
|
||||
## Pod 安全准入配置模板
|
||||
|
||||
Rancher 提供了 PSA 配置模板。它们是可以应用到集群的预定义安全配置。Rancher 管理员(或具有权限的人员)可以[创建、管理和编辑](./psa-config-templates.md) PSA 模板。
|
||||
|
||||
-2
@@ -159,8 +159,6 @@ Kubernetes v1.22 是 Rancher 2.6.3 的实验功能,不支持使用 apiVersion
|
||||
|
||||
使用与第一个集群上使用的相同版本的 Helm 来安装 Rancher:
|
||||
|
||||
对于 Kubernetes v1.25 或更高版本,使用 Rancher v2.7.2-v2.7.4 时,将 `global.cattle.psp.enabled` 设置为 `false`。对于 Rancher v2.7.5 及更高版本来说,这不是必需的,但你仍然可以手动设置该选项。
|
||||
|
||||
```bash
|
||||
helm install rancher rancher-latest/rancher \
|
||||
--namespace cattle-system \
|
||||
|
||||
+1
-10
@@ -240,15 +240,7 @@ Rancher 没有注册的 Kubernetes 集群(除了 RKE2 和 K3s Kubernetes 集
|
||||
|
||||
但是,如果集群具有某种功能(例如使用 pod 安全策略),那么该集群的用户可能仍希望在 Rancher UI 中为集群选择 pod 安全策略。为此,用户需要手动让 Rancher 知道集群已启用 pod 安全策略。
|
||||
|
||||
通过对已注册的集群进行注释,你可以向 Rancher 表明集群在 Rancher 之外被赋予了 Pod 安全策略或其他功能。
|
||||
|
||||
此示例注释表示启用了 pod 安全策略:
|
||||
|
||||
```json
|
||||
"capabilities.cattle.io/pspEnabled": "true"
|
||||
```
|
||||
|
||||
以下注释表示 Ingress 功能。请注意,非原始对象的值需要进行 JSON 编码,并转义引号:
|
||||
通过对已注册的集群进行注释,你可以向 Rancher 表明集群在 Rancher 之外被赋予了 Ingress 功能或其他功能。以下注释表示 Ingress 功能。请注意,非原始对象的值需要进行 JSON 编码,并转义引号:
|
||||
|
||||
```json
|
||||
"capabilities.cattle.io/ingressCapabilities": "[
|
||||
@@ -265,7 +257,6 @@ Rancher 没有注册的 Kubernetes 集群(除了 RKE2 和 K3s Kubernetes 集
|
||||
- `loadBalancerCapabilities`
|
||||
- `nodePoolScalingSupported`
|
||||
- `nodePortRange`
|
||||
- `pspEnabled`
|
||||
- `taintSupport`
|
||||
|
||||
所有功能及其类型定义都可以在 Rancher API 视图中查看,地址是 `[Rancher Server URL]/v3/schemas/capabilities`。
|
||||
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
---
|
||||
title: 添加 Pod 安全策略
|
||||
---
|
||||
|
||||
:::note 先决条件:
|
||||
|
||||
以下选项仅适用于[使用 RKE 启动的集群](../launch-kubernetes-with-rancher/launch-kubernetes-with-rancher.md)。
|
||||
|
||||
:::
|
||||
|
||||
当你的集群上运行了具有安全敏感配置的 pod 时,请为其分配 [pod 安全策略](../authentication-permissions-and-global-configuration/create-pod-security-policies.md),这是一组用于监控 pod 中的状态和设置的规则。如果 pod 不符合你的策略中指定的规则,则该策略会阻止它运行。
|
||||
|
||||
你可以在配置集群时分配 pod 安全策略。如果你以后需要放松或限制 pod 的安全性,你可以在编辑集群时更新策略:
|
||||
|
||||
1. 点击 **☰ > 集群管理**。
|
||||
1. 转到要应用 pod 安全策略的集群,然后单击 **⋮ > 编辑配置**。
|
||||
1. 在 **Pod 安全策略支持**中,选择**启用**。
|
||||
|
||||
:::note
|
||||
|
||||
此选项仅适用于[由 RKE 配置的集群](../launch-kubernetes-with-rancher/launch-kubernetes-with-rancher.md)。
|
||||
|
||||
:::
|
||||
|
||||
4. 从**默认 Pod 安全策略**下拉列表中,选择要应用于集群的策略。
|
||||
|
||||
Rancher 支持了`受限`和`不受限`的[策略](../authentication-permissions-and-global-configuration/create-pod-security-policies.md#默认-psp),你也可以[创建自定义策略](../authentication-permissions-and-global-configuration/create-pod-security-policies.md#创建-psp)。
|
||||
|
||||
5. 单击**保存**。
|
||||
|
||||
**结果**:pod 安全策略应用于集群和集群内的任何项目。
|
||||
|
||||
:::note
|
||||
|
||||
在分配 pod 安全策略之前已经运行的工作负载是不受限制的。即使它们不符合你的 pod 安全策略,在分配策略之前运行的工作负载也会继续运行。
|
||||
|
||||
要检查正在运行的工作负载是否通过了你的 pod 安全策略,请克隆或升级它。
|
||||
|
||||
:::
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
---
|
||||
title: 分配 Pod 安全策略
|
||||
---
|
||||
|
||||
_Pod 安全策略_(PSP)是控制 Pod 安全的规范(如是否可以使用 root 权限等)的对象。
|
||||
|
||||
## 添加默认 Pod 安全策略
|
||||
|
||||
使用 RKE 创建新集群时,你可以将其配置为立即应用 PSP。创建集群时,使用**集群选项**来启用 PSP。分配给集群的 PSP 将是集群内项目的默认 PSP。
|
||||
|
||||
:::note 先决条件:
|
||||
|
||||
在 Rancher 中创建 Pod 安全策略。在将默认 PSP 分配给新集群之前,你必须有一个可分配的 PSP。有关说明,请参阅[创建 Pod 安全策略](../authentication-permissions-and-global-configuration/create-pod-security-policies.md)。
|
||||
|
||||
:::
|
||||
|
||||
:::note
|
||||
|
||||
出于安全考虑,我们建议你在创建集群时分配 PSP。
|
||||
|
||||
:::
|
||||
|
||||
要启用默认 Pod 安全策略,请将 **Pod 安全策略支持**选项设置为**启用**,然后从**默认 Pod 安全策略**下拉框中进行选择。
|
||||
|
||||
集群完成配置后,你选择的 PSP 将应用于集群内的所有项目。
|
||||
+6
-17
@@ -122,12 +122,11 @@ Rancher 在 Kubernetes 之上进行了扩展,除了集群级别之外,还允
|
||||
|
||||
本节介绍如何创建具有名称以及可选 pod 安全策略、成员和资源配额的新项目。
|
||||
|
||||
1. [命名新项目](#1-命名新项目)
|
||||
2. [可选:选择 pod 安全策略](#2-可选选择-pod-安全策略)
|
||||
3. [推荐:添加项目成员](#3-推荐添加项目成员)
|
||||
4. [可选:添加资源配额](#4-可选添加资源配额)
|
||||
1. [命名新项目](#命名新项目)
|
||||
1. [推荐:添加项目成员](#推荐添加项目成员)
|
||||
1. [可选:添加资源配额](#可选添加资源配额)
|
||||
|
||||
### 1. 命名新项目
|
||||
### 命名新项目
|
||||
|
||||
1. 在左上角,单击 **☰ > 集群管理**。
|
||||
1. 在**集群**页面上,转到要在其中创建项目的集群,然后单击 **Explore**。
|
||||
@@ -135,17 +134,7 @@ Rancher 在 Kubernetes 之上进行了扩展,除了集群级别之外,还允
|
||||
1. 单击**创建项目**。
|
||||
1. 输入**项目名称**。
|
||||
|
||||
### 2. 可选:选择 Pod 安全策略
|
||||
|
||||
此选项仅在 Pod 安全策略已创建时可用。有关说明,请参阅[创建 Pod 安全策略](../authentication-permissions-and-global-configuration/create-pod-security-policies.md)。
|
||||
|
||||
将 PSP 分配给项目将:
|
||||
|
||||
- 覆盖集群的默认 PSP。
|
||||
- 将 PSP 应用于项目。
|
||||
- 将 PSP 应用到后续添加到项目中的命名空间。
|
||||
|
||||
### 3. 推荐:添加项目成员
|
||||
### 推荐:添加项目成员
|
||||
|
||||
使用**成员**为其他用户提供项目访问权限和角色。
|
||||
|
||||
@@ -175,7 +164,7 @@ Rancher 在 Kubernetes 之上进行了扩展,除了集群级别之外,还允
|
||||
:::
|
||||
1. 在**项目权限**中选择一个角色。如需更多信息,请参阅[项目角色文档](../authentication-permissions-and-global-configuration/manage-role-based-access-control-rbac/cluster-and-project-roles.md)。
|
||||
|
||||
### 4. 可选:添加资源配额
|
||||
### 可选:添加资源配额
|
||||
|
||||
资源配额用于限制项目(及其命名空间)可以使用的资源。有关详细信息,请参阅[资源配额](../../advanced-user-guides/manage-projects/manage-project-resource-quotas/manage-project-resource-quotas.md)。
|
||||
|
||||
|
||||
-4
@@ -30,10 +30,6 @@ Monitoring 应用设置了 `prometheus.prometheusSpec.ignoreNamespaceSelectors=f
|
||||
|
||||
详情请参阅[本节](selectors-and-scrape-configurations.md)。
|
||||
|
||||
## 在具有 Pod 安全策略的情况下启用 Istio
|
||||
|
||||
详情请参阅[本节](pod-security-policies.md)。
|
||||
|
||||
## 在 RKE2 集群上安装 Istio 的其他步骤
|
||||
|
||||
详情请参阅[本节](install-istio-on-rke2-cluster.md)。
|
||||
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
---
|
||||
title: 在具有 Pod 安全策略的情况下启用 Istio
|
||||
---
|
||||
|
||||
如果你启用了限制性 Pod 安全策略(Pod Security Policy),由于 Istio 需要某些权限才能自行安装和管理 pod 基础设施,因此 Istio 可能无法正常运行。在本文中,我们将配置一个为 Istio 启用了 PSP 的集群,并设置 Istio CNI 插件。
|
||||
|
||||
Istio CNI 插件不再要求每个应用 pod 具有特权 `NET_ADMIN` 容器。如需更多信息,请参阅 [Istio CNI 插件文档](https://istio.io/docs/setup/additional-setup/cni)。请注意,[Istio CNI 插件处于 alpha 阶段](https://istio.io/about/feature-stages/)。
|
||||
|
||||
:::note 先决条件:
|
||||
|
||||
- 集群必须是 RKE Kubernetes 集群。
|
||||
- 必须使用默认 PodSecurityPolicy 创建集群。
|
||||
|
||||
要在使用 Rancher UI 创建 Kubernetes 集群时启用 Pod 安全策略支持,请转到<b>高级选项</b>。在 <b>Pod 安全策略支持</b>中,单击<b>启用</b>,然后选择一个默认的 pod 安全策略。
|
||||
|
||||
:::
|
||||
|
||||
1. [将 PodSecurityPolicy 设置为不受限制](#1-将-podsecuritypolicy-设置为不受限制)
|
||||
2. [启用 CNI](#2-启用-cni)
|
||||
3. [验证 CNI 是否正常工作](#3-验证-cni-是否正常工作)
|
||||
|
||||
## 1. 将 PodSecurityPolicy 设置为不受限制
|
||||
|
||||
不受限制的 PSP 支持安装 Istio。
|
||||
|
||||
在安装 Istio 的项目或计划安装 Istio 的项目中,将 PSP 设置为 `unrestricted`。
|
||||
|
||||
1. 点击 **☰ > 集群管理**。
|
||||
1. 选择你创建的集群,并点击 **Explore**。
|
||||
1. 单击**集群 > 项目/命名空间**。
|
||||
1. 找到**项目: System**,然后选择 **⋮ > 编辑配置**。
|
||||
1. 将 Pod 安全策略选项更改为不受限制,然后单击**保存**。
|
||||
|
||||
## 2. 启用 CNI
|
||||
|
||||
通过 **Apps** 安装或升级 Istio 时:
|
||||
|
||||
1. 单击**组件**。
|
||||
2. 选中**启用 CNI**旁边的框。
|
||||
3. 完成 Istio 的安装或升级。
|
||||
|
||||
你也可以通过编辑 `values.yaml` 来启用 CNI:
|
||||
|
||||
```
|
||||
istio_cni.enabled: true
|
||||
```
|
||||
|
||||
在集群中启用 CNI 后,Istio 应该能成功安装。
|
||||
|
||||
## 3. 验证 CNI 是否正常工作
|
||||
|
||||
通过部署[示例应用](https://istio.io/latest/docs/examples/bookinfo/)或部署你自己的应用,来验证 CNI 是否正常工作。
|
||||
|
||||
-6
@@ -145,12 +145,6 @@ Rancher v2.6 引入了[为 RKE 集群配置 ECR 镜像仓库](https://rancher.co
|
||||
|
||||
每个能够使用 RKE 启动集群的云提供商都可以收集指标并监控你的集群节点。如果启用此选项,你可以从你的云提供商门户查看你的节点指标。
|
||||
|
||||
### Pod 安全策略支持
|
||||
|
||||
为集群启用 [pod 安全策略](../../../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md)。启用此选项后,使用**默认 Pod 安全策略**下拉菜单选择一个策略。
|
||||
|
||||
你必须有已配置的 Pod 安全策略才能使用此选项。
|
||||
|
||||
### 节点上的 Docker 版本
|
||||
|
||||
表示是否允许节点运行 Rancher 不正式支持的 Docker 版本。
|
||||
|
||||
-4
@@ -124,10 +124,6 @@ Rancher 与以下开箱即用的网络提供商兼容:
|
||||
|
||||
:::
|
||||
|
||||
#### 默认 Pod 安全策略
|
||||
|
||||
为集群选择默认的 [pod 安全策略](../../../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md)。请参阅 [RKE2 文档](https://docs.rke2.io/security/pod_security_policies)来了解每个可用策略的规范。
|
||||
|
||||
#### Worker CIS 配置文件
|
||||
|
||||
选择一个 [CIS benchmark](../../../how-to-guides/advanced-user-guides/cis-scan-guides/cis-scan-guides.md) 来验证系统配置。
|
||||
|
||||
+2
-8
@@ -26,27 +26,21 @@ Rancher 使用以下 Kubernetes 发行版:
|
||||
|
||||
| Kubernetes 版本 | CIS Benchmark 版本 | 自我评估指南 | 加固指南 |
|
||||
|--------------------|-----------------------|-----------------------|------------------|
|
||||
| Kubernetes v1.23 | CIS v1.23 | [链接](rke1-hardening-guide/rke1-self-assessment-guide-with-cis-v1.23-k8s-v1.23.md) | [链接](rke1-hardening-guide/rke1-hardening-guide.md) |
|
||||
| Kubernetes v1.24 | CIS v1.24 | [链接](rke1-hardening-guide/rke1-self-assessment-guide-with-cis-v1.24-k8s-v1.24.md) | [链接](rke1-hardening-guide/rke1-hardening-guide.md) |
|
||||
| Kubernetes v1.25/v1.26/v1.27 | CIS v1.7 | [链接](rke1-hardening-guide/rke1-self-assessment-guide-with-cis-v1.7-k8s-v1.25-v1.26-v1.27.md) | [链接](rke1-hardening-guide/rke1-hardening-guide.md) |
|
||||
|
||||
### RKE2 指南
|
||||
|
||||
| 类型 | Kubernetes 版本 | CIS Benchmark 版本 | 自我评估指南 | 加固指南 |
|
||||
|------|--------------------|-----------------------|-----------------------|------------------|
|
||||
| Rancher provisioned RKE2 | Kubernetes v1.23 | CIS v1.23 | [链接](rke2-hardening-guide/rke2-self-assessment-guide-with-cis-v1.23-k8s-v1.23.md) | [链接](rke2-hardening-guide/rke2-hardening-guide.md) |
|
||||
| Rancher provisioned RKE2 | Kubernetes v1.24 | CIS v1.24 | [链接](rke2-hardening-guide/rke2-self-assessment-guide-with-cis-v1.24-k8s-v1.24.md) | [链接](rke2-hardening-guide/rke2-hardening-guide.md) |
|
||||
| Rancher provisioned RKE2 | Kubernetes v1.25/v1.26/v1.27 | CIS v1.7 | [链接](rke2-hardening-guide/rke2-self-assessment-guide-with-cis-v1.7-k8s-v1.25-v1.26-v1.27.md) | [链接](rke2-hardening-guide/rke2-hardening-guide.md) |
|
||||
| Standalone RKE2 | Kubernetes v1.25/v1.26/v1.27 | CIS v1.7 | [链接](https://docs.rke2.io/security/cis_self_assessment123) | [链接](https://docs.rke2.io/security/hardening_guide) |
|
||||
| Standalone RKE2 | Kubernetes v1.27-v1.32 | CIS v1.9 | [链接](https://docs.rke2.io/security/cis_self_assessment19) | [链接](https://docs.rke2.io/security/hardening_guide) |
|
||||
|
||||
### K3s 指南
|
||||
|
||||
| 类型 | Kubernetes 版本 | CIS Benchmark 版本 | 自我评估指南 | 加固指南 |
|
||||
|------|--------------------|-----------------------|-----------------------|------------------|
|
||||
| Rancher provisioned K3s cluster | Kubernetes v1.23 | CIS v1.23 | [链接](k3s-hardening-guide/k3s-self-assessment-guide-with-cis-v1.23-k8s-v1.23.md) | [链接](k3s-hardening-guide/k3s-hardening-guide.md) |
|
||||
| Rancher provisioned K3s cluster | Kubernetes v1.24 | CIS v1.24 | [链接](k3s-hardening-guide/k3s-self-assessment-guide-with-cis-v1.24-k8s-v1.24.md) | [链接](k3s-hardening-guide/k3s-hardening-guide.md) |
|
||||
| Rancher provisioned K3s cluster | Kubernetes v1.25/v1.26/v1.27 | CIS v1.7 | [链接](k3s-hardening-guide/k3s-self-assessment-guide-with-cis-v1.7-k8s-v1.25-v1.26-v1.27.md) | [链接](k3s-hardening-guide/k3s-hardening-guide.md) |
|
||||
| Standalone K3s | Kubernetes v1.22 up to v1.24 | CIS v1.23 | [链接](https://docs.k3s.io/security/self-assessment-1.8) | [链接](https://docs.k3s.io/security/hardening-guide) |
|
||||
| Standalone K3s | Kubernetes v1.26 up to v1.29 | CIS v1.8 | [链接](https://docs.k3s.io/security/self-assessment-1.8) | [链接](https://docs.k3s.io/security/hardening-guide) |
|
||||
|
||||
## 在 SELinux 上使用 Rancher
|
||||
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ kernel.panic_on_oops=1
|
||||
|
||||
## Kubernetes 运行时要求
|
||||
|
||||
CIS Benchmark 的运行时要求主要围绕 Pod 安全(通过 PSP 或 PSA)、网络策略和 API 服务器审计日志展开。
|
||||
CIS Benchmark 的运行时要求主要围绕 Pod 安全(通过 PSA)、网络策略和 API 服务器审计日志展开。
|
||||
|
||||
默认情况下,K3s 不包含任何 Pod 安全或网络策略。然而,K3s 附带一个控制器,可以强制执行你创建的任何网络策略。默认情况下,K3s 启用了 `PodSecurity` 和 `NodeRestriction` 等多个准入控制器。
|
||||
|
||||
|
||||
-3152
File diff suppressed because it is too large
Load Diff
-3208
File diff suppressed because it is too large
Load Diff
-1
@@ -155,7 +155,6 @@ done
|
||||
## 已知限制
|
||||
|
||||
- 当注册自定义节点仅提供公共 IP 时,Rancher **exec shell** 和 **查看 pod 日志** 在加固设置中**不起作用**。 此功能需要在注册自定义节点时提供私有 IP。
|
||||
- 当根据 Rancher [提供](../../../../how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/create-pod-security-policies.md)的 Pod 安全策略 (Pod Security Policies, PSP) 将 `default_pod_security_policy_template_id:` 设置为 `restricted` 或 `restricted-noroot` 时,Rancher 会在 `default` service accounts 上创建 `RoleBindings` 和 `ClusterRoleBindings`。CIS 检查 5.1.5 要求除了默认角色之外,`default` service accounts 不应绑定其他角色或集群角色。此外,`default` service accounts 应配置为不提供服务账户令牌,也不具有任何明确的权限分配。
|
||||
|
||||
## 加固的 RKE `cluster.yml` 配置参考
|
||||
|
||||
|
||||
-3089
File diff suppressed because one or more lines are too long
-3048
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user