Assuming you have installed Service Binding Operator via OperatorHub.
kubectl apply -f - << EOD
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: etcd
namespace: openshift-operators
spec:
channel: clusterwide-alpha
installPlanApproval: Automatic
name: etcd
source: community-operators
sourceNamespace: openshift-marketplace
startingCSV: etcdoperator.v0.9.4-clusterwide
EOD
kubectl apply -f - << EOD
---
apiVersion: "etcd.database.coreos.com/v1beta2"
kind: "EtcdCluster"
metadata:
annotations:
etcd.database.coreos.com/scope: clusterwide
name: "etcd-cluster-example"
spec:
repository: quay.io/coreos/etcd
size: 3
version: "3.2.13"
EOD
Example application : https://github.com/akashshinde/node-todo.git
Note: This example assumes the app is deployed using a K8s Deployment. If using an OCP DeploymentConfig
change the group and resource in the application to:
...
spec:
...
application:
...
group: apps.openshift.io
version: v1
resource: deploymentconfigs
kubectl apply -f - << EOD
---
apiVersion: binding.operators.coreos.com/v1alpha1
kind: ServiceBinding
metadata:
name: binding-request
spec:
application:
group: apps
version: v1
resource: deployments
name: node-todo-git
services:
- group: etcd.database.coreos.com
version: v1beta2
kind: EtcdCluster
name: etcd-cluster-example
detectBindingResources: true
EOD