---
# System prepended metadata

title: Deploying applications on Red Hat OpenShift Service Mesh

---

# Deploying applications on Red Hat OpenShift Service Mesh

## Environment
- OpenShift 4.2.7 (3 master + 3 compute)
- Installd Operators (in istio-service)
![](https://i.imgur.com/XtUHXtU.png)

## Prerequisite
- [OpenShift Service Mesh - Istio installation and configuration][1]
- [sidecar.istio.io/inject does not work #11854][5]

## Test Applications

1. bookinfo (using Deployment)
![](https://i.imgur.com/wENJs5X.png)

```bash
oc new-project bookinfo
oc apply -n bookinfo -f https://raw.githubusercontent.com/Maistra/bookinfo/maistra-1.0/bookinfo.yaml
oc apply -n bookinfo -f https://raw.githubusercontent.com/Maistra/bookinfo/maistra-1.0/bookinfo-gateway.yaml
oc apply -n bookinfo -f https://raw.githubusercontent.com/istio/istio/release-1.1/samples/bookinfo/networking/destination-rule-all.yaml
```

2. Simple HTTP Page (using Deployement Config)

![](https://i.imgur.com/HA5LK3S.png)

```bash
oc new-app https://github.com/pichuang/time --context-dir=rhel
```

## Automatic Inject Sidecar

`spec.template.metadata.annotations:` sidecar.istio.io/inject: 'true'

- In Deployment
```bash
...omit...

kind: Deployment
apiVersion: apps/v1
metadata:
  annotations:
    deployment.kubernetes.io/revision: '1'
  name: details-v1
  namespace: bookinfo
  labels:
    app: details
    version: v1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: details
      version: v1
  template:  <--- Should under template
    metadata:

...omit...

      annotations:
        sidecar.istio.io/inject: 'true' <--- Append

...omit...
```

- In Deployment Config
```bash
kind: DeploymentConfig
apiVersion: apps.openshift.io/v1

...omit...

  template: <-- Should under template
    metadata:
      creationTimestamp: null
      labels:
        app: time
        deploymentconfig: time
      annotations:
        openshift.io/generated-by: OpenShiftNewApp
        sidecar.istio.io/inject: 'true'  <--- Append
    spec:

...omit...
```

## References
- [OpenShift Service Mesh - Istio installation and configuration][1]
- [openshiftv3-workshop/1-Create-App-From-a-Docker-Image.adoc][2]
- [Installing Red Hat OpenShift Service Mesh][3]
- [Enabling automatic sidecar injection][4]
- [sidecar.istio.io/inject does not work #11854][5]

[1]: https://hackmd.io/@-NygPmSYSkulcwHiqKwsuw/rkWZinh2H
[2]: https://github.com/pichuang/openshiftv3-workshop/blob/master/1-Create-App-From-a-Docker-Image.adoc
[3]: https://docs.openshift.com/container-platform/4.2/service_mesh/service_mesh_install/installing-ossm.html#installing-ossm
[4]: https://docs.openshift.com/container-platform/4.2/service_mesh/service_mesh_day_two/prepare-to-deploy-applications-ossm.html#ossm-automatic-sidecar-injection_deploying-applications-ossm
[5]: https://github.com/istio/istio/issues/11854#issuecomment-465327585