Enable Istio with Pod Security Policies
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. Please note that the Istio CNI Plugin is in alpha.
The steps differ based on the Rancher version.
- v2.5.4+
- v2.5.0-v2.5.3
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 Advanced Options. In the Pod Security Policy Support section, click Enabled. Then select a default pod security policy.
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.
- From the cluster view of the Cluster Manager, select Projects/Namespaces.
- Find the Project: System and select the ⋮ > Edit.
- Change the Pod Security Policy option to be unrestricted, then click Save.
2. Enable the CNI
When installing or upgrading Istio through Apps & Marketplace,
- Click Components.
- Check the box next to Enabled CNI.
- 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 or deploying one of your own applications.
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 Advanced Options. In the Pod Security Policy Support section, click Enabled. Then select a default pod security policy.
- Configure the System Project Policy to allow Istio install.
- Install the CNI plugin in the System project.
- Install Istio.
1. Configure the System Project Policy to allow Istio install
- From the cluster view of the Cluster Manager, select Projects/Namespaces.
- Find the Project: System and select the ⋮ > Edit.
- Change the Pod Security Policy option to be unrestricted, then click Save.
2. Install the CNI Plugin in the System Project
- From the main menu of the Dashboard, select Projects/Namespaces.
- Select the Project: System project.
- Choose Tools > Catalogs in the navigation bar.
- Add a catalog with the following:
- Name: istio-cni
- Catalog URL: https://github.com/istio/cni
- Branch: The branch that matches your current release, for example:
release-1.4
.
- From the main menu select Apps
- Click Launch and select istio-cni
- Update the namespace to be "kube-system"
- In the answers section, click "Edit as YAML" and paste in the following, then click launch:
---
logLevel: "info"
excludeNamespaces:
- "istio-system"
- "kube-system"
3. Install Istio
Follow the primary instructions, adding a custom answer: istio_cni.enabled: true
.
After Istio has finished installing, the Apps page in System Projects should show both istio and istio-cni
applications deployed successfully. Sidecar injection will now be functional.