copyright: years: 2018, 2023 lastupdated: "2023-01-05"
Deploying the Text to Speech Adapter to Kubernetes in IBM Cloud Kubernetes Service
You can deploy the Text to Speech 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 Text to Speech service instance.
-
Sign up for Google Cloud, and follow the Cloud Text-to-Speech API Quickstart documentation to complete the following steps:
- Create a Google Cloud project that enables Cloud Text-to-Speech API.
- Create a service account for the project.
- Download the private key JSON file, which contains credentials for your service account.
Deploying the Text to Speech 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
tts-adapter/kubernetes/deploy.yaml
Kubernetes deployment file, and copy it to your Voice Gateway deployment directory.The
deploy.yaml
file contains the configuration information for the Text to Speech Adapter (tts-adapter
) container. Theenv
object for each container contains a list of name-value pairs, which each correspond with the configuration environment variables. -
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
-
Mount the Google credentials file to the deployment by specifying the name of the file in the
volumes
section of thedeploy.json
file.For example:
{ ... "volumes": [ { "name": "google-credentials", "secret": { "secretName": "google-credentials", "items": [{ "key": "my-google-project-f4b426929b20.json", "path": "my-google-project-f4b426929b20.json" }] } } ] }
-
Under the
tts-adapter
container, specify the Google credentials file location in theGOOGLE_APPLICATION_CREDENTIALS
environment variable.For example:
{ "name": "GOOGLE_APPLICATION_CREDENTIALS", "value": "/tts-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.yaml
Running this command deploys one Text To Speech Adapter pod on a single worker node within a Kubernetes cluster.
-
Following the steps in Deploying Voice Gateway to Kubernetes in IBM Cloud Kubernetes Service, configure the Voice Gateway to use the Text To Speech Adapter. Open the
deploy.json
file and configure the Watson Text To Speech environment variables to use the Text To Speech Adapter:{ "name": "WATSON_TTS_URL", "value": "http://tts.adapter:4500" }
Re-deploy the Voice Gateway deployment in order for the changes to take effect.
What to do next
You can further configure your Voice Gateway or Text To Speech deployment by editing the deploy.json
and deploy.yaml
files respectively to add or change configuration variables and then redeploying
your pod.