GitHubContribute in GitHub: Edit online

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

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.

  1. 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. The env object for each container contains a list of name-value pairs, which each correspond with the configuration environment variables.

  2. 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
    

  3. 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:

    {
      ...
      "volumes": [
        {
            "name": "google-credentials",
            "secret": {
              "secretName": "google-credentials",
              "items": [{
                "key": "my-google-project-f4b426929b20.json",
                "path": "my-google-project-f4b426929b20.json"
              }]
            }
          }
      ]
    }
    

  4. Under the tts-adapter container, specify the Google credentials file location in the GOOGLE_APPLICATION_CREDENTIALS environment variable.

    For example:

      {
        "name": "GOOGLE_APPLICATION_CREDENTIALS",
        "value": "/tts-adapter/credentials/my-google-project-f4b426929b20.json"
      }
    

  5. 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.

  6. 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.