OpenShift

Follow these instructions to prepare an OpenShift cluster for Istio.

By default, OpenShift doesn’t allow containers running with user ID 0. You must enable containers running with UID 0 for Istio’s service accounts by running the command below. Make sure to replace istio-system if you are deploying Istio in another namespace:

$ oc adm policy add-scc-to-group anyuid system:serviceaccounts -n istio-system

Now you can install Istio using the CNI instructions.

After installation is complete, expose an OpenShift route for the ingress gateway.

$ oc -n istio-system expose svc/istio-ingressgateway --port=80

Automatic sidecar injection

Webhook and certificate signing requests support must be enabled for automatic injection to work. Modify the master configuration file on the master node for the cluster as follows.

In the same directory as the master configuration file, create a file named master-config.patch with the following contents:

admissionConfig:
  pluginConfig:
    MutatingAdmissionWebhook:
      configuration:
        apiVersion: apiserver.config.k8s.io/v1alpha1
        kubeConfigFile: /dev/null
        kind: WebhookAdmission
    ValidatingAdmissionWebhook:
      configuration:
        apiVersion: apiserver.config.k8s.io/v1alpha1
        kubeConfigFile: /dev/null
        kind: WebhookAdmission

In the same directory, execute:

$ cp -p master-config.yaml master-config.yaml.prepatch
$ oc ex config patch master-config.yaml.prepatch -p "$(cat master-config.patch)" > master-config.yaml
$ master-restart api
$ master-restart controllers

Privileged security context constraints for application sidecars

The Istio sidecar injected into each application pod runs with user ID 1337, which is not allowed by default in OpenShift. To allow this user ID to be used, execute the following commands. Replace <target-namespace> with the appropriate namespace.

$ oc adm policy add-scc-to-group privileged system:serviceaccounts -n <target-namespace>
$ oc adm policy add-scc-to-group anyuid system:serviceaccounts -n <target-namespace>

When removing your application, remove the permissions as follows.

$ oc adm policy remove-scc-from-group privileged system:serviceaccounts -n <target-namespace>
$ oc adm policy remove-scc-from-group anyuid system:serviceaccounts -n <target-namespace>
Was this information useful?
Do you have any suggestions for improvement?

Thanks for your feedback!