copyright: years: 2018, 2023 lastupdated: "2023-01-05"
Deploying Voice Gateway with the Speech to Text Adapter to Kubernetes in IBM Cloud Kubernetes Service
You can deploy the Speech to Text Adapter as part of your IBM® Voice Gateway environment in the cloud by deploying it to a Kubernetes cluster in IBM® Cloud Kubernetes Service.
Before you begin
-
Familiarize yourself with Voice Gateway deployment options and deploy a basic environment as described in Getting started with Voice Gateway.
-
If you're implementing a self-service agent, find and make note of the credentials for your instances of the following Watson services:
You will not need a Speech to Text service instance.
-
Sign up for Google Cloud, and follow the Cloud Speech API Quickstart documentation to complete the following steps:
- Create a Google Cloud project that enables Cloud Speech API.
- Create a service account for the project.
- Download the private key JSON file, which contains credentials for your service account.
Deploying the Speech to Text Adapter to a Kubernetes cluster in IBM Cloud
The following instructions assume that you have already successfully deployed a basic Voice Gateway environment to Kubernetes on IBM Cloud. For complete setup information for getting started in IBM Cloud Kubernetes Service, see Deploying Voice Gateway to Kubernetes in IBM Cloud Kubernetes Service.
-
In your local clone of the sample.voice.gateway repository, find the
stt-adapter/kubernetes/bluemix/single-tenant/deploy.json
Kubernetes deployment file, and copy it to your Voice Gateway deployment directory.The
deploy.json
file contains the configuration information for the Media Relay (vgw-media-relay
), SIP Orchestrator (vgw-sip-orchestrator
), and Speech to Text Adapter (stt-adapter
) containers. Theenv
object for each container contains a list of name-value pairs, which each correspond with the configuration environment variables. -
For self-service agents, open the
deploy.json
file and fill in the following Watson service credentials.vgw-media-relay
container: Specify the Text to Speechusername
credential in theWATSON_TTS_USERNAME
variable.vgw-sip-orchestrator
container: Specify the Watson Assistant workspace ID andusername
credential in theWATSON_CONVERSATION_WORKSPACE_ID
andWATSON_CONVERSATION_USERNAME
variables.
Important: Do not specify the
password
credentials for the services within in the file. To secure your credentials, you will create a Kubernetes secret.For example:
{ "name": "WATSON_TTS_USERNAME", "value": "9h7f54cb-5epb-80d6-45c3-da41d2bf7a71" }
{:codeblock}
1. Create a Kubernetes secret to store the password credentials for the Text to Speech and Watson Assistant services.
To create the secret, run the `kubectl create secret generic secret-creds` command. Use the `--from-literal` option to specify the password credential for each service on the `WATSON_TTS_PASSWORD` and `WATSON_CONVERSATION_PASSWORD` environment variables.
For example:
```
kubectl create secret generic secret-creds \
--from-literal=WATSON_TTS_PASSWORD='rkxF6JIpLDz' --from-literal=WATSON_CONVERSATION_PASSWORD='prqNfi8Dsj'
{:codeblock}
This secret can be reused each time you redeploy Voice Gateway. You only need to recreate the secret if you change service instances.
-
Create a Kubernetes secret to store the credentials JSON file that you downloaded from your Google Cloud project. Use the
--from-file
option to specify the path to the Google credentials file.For example:
kubectl create secret generic google-credentials --from-file=/Users/user1/my-google-project-f4b426929b20.json
{:codeblock}
1. Mount the Google credentials file to the deployment by specifying the name of the file in the `volumes` section of the `deploy.json` file.
For example:
```json
{
...
"volumes": [
{
"name": "google-credentials",
"secret": {
"secretName": "google-credentials",
"items": [{
"key": "my-google-project-f4b426929b20.json",
"path": "my-google-project-f4b426929b20.json"
}]
}
}
]
}
{:codeblock}
-
Under the
stt-adapter
container, specify the Google credentials file location in theGOOGLE_APPLICATION_CREDENTIALS
environment variable.For example:
{ "name": "GOOGLE_APPLICATION_CREDENTIALS", "value": "/stt-adapter/credentials/my-google-project-f4b426929b20.json" }
-
Create and deploy a Kubernetes pod that contains the Voice Gateway containers by specifying your deployment file on the
kubectl create
command.
kubectl create -f deploy.json
{:codeblock}
Running this command deploys one Voice Gateway pod on a single worker node within a Kubernetes cluster.
## What to do next {: #next}
You can further configure your Voice Gateway deployment by editing the `deploy.json` file to add or change [configuration variables](https://www.ibm.com/docs/en/voice-gateway?topic=reference-configuration-environment-variables) and then redeploying your pod.