1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-07 00:48:01 +01:00
Files
openshift-docs/modules/ossm-automatic-sidecar-injection.adoc
2020-10-06 16:48:41 -04:00

51 lines
1.4 KiB
Plaintext

// Module included in the following assemblies:
//
// * service_mesh/v1x/prepare-to-deploy-applications-ossm.adoc
// * service_mesh/v2x/prepare-to-deploy-applications-ossm.adoc
[id="ossm-automatic-sidecar-injection_{context}"]
= Enabling automatic sidecar injection
When deploying an application into the {ProductName} you must opt in to injection by specifying the `sidecar.istio.io/inject` annotation with a value of `"true"`. Opting in ensures that the sidecar injection does not interfere with other OpenShift features such as builder pods used by numerous frameworks within the OpenShift ecosystem.
.Prerequisites
* Identify the deployments for which you want to enable automatic sidecar injection.
* Locate the application's YAML configuration file.
.Procedure
. Open the application's configuration YAML file in an editor.
. Add `sidecar.istio.io/inject` to the configuration YAML with a value of `"true"` as illustrated here:
+
.Sleep test application example
[source,yaml]
----
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: sleep
name: sleep
spec:
replicas: 1
selector:
matchLabels:
app: sleep
template:
metadata:
annotations:
sidecar.istio.io/inject: "true"
labels:
app: sleep
spec:
containers:
- name: sleep
image: tutum/curl
command: ["/bin/sleep","infinity"]
imagePullPolicy: IfNotPresent
----
. Save the configuration file.