Service Binding
Service binding trait will bind data from Kubernetes to the application container’s ENV.
- Prepare a Kubernetes Secret
The secret can be manually created, or generated by other component or external system.
For example, we have a webservice component who needs to consume a database. The database connection string should be set to Pod environments: endpoint
, and DB_PASSWORD
.
We can set the properties for envMappings as below. For each environment, secret
represents the secret name, and key
represents the key of the secret.
In particular, if the environment name, like , is same to the key
of the secret, we can omit the key
. So we can simplify the properties as below.
We can finally prepare an Application for the business component binding-test-comp
to consume the secret, which is a representative of a database cloud resource.
Specification
KeySecret
Name | Description | Type | Required | Default |
---|---|---|---|---|
key | if key is empty, we will use envMappings key instead | string | false | |
secret | Kubernetes secret name | string | true |