将 Text to Speech Adapter 部署到 IBM Cloud Kubernetes Service 中的 Kubernetes

要在云中将 Text to Speech Adapter 部署为 IBM® Voice Gateway 环境的一部分,您可以将其部署到 IBM® Cloud Kubernetes Service 中的 Kubernetes 集群。

开始之前

将 Text to Speech Adapter 部署到 IBM Cloud 中的 Kubernetes

以下指示信息假设您已成功将基本 Voice Gateway 环境部署到 IBM Cloud 中的 Kubernetes。有关 IBM Cloud Kubernetes Service 入门的完整设置信息,请参阅将 Voice Gateway 部署到 IBM Cloud Kubernetes Service 中的 Kubernetes

  1. sample.voice.gateway 存储库的本地克隆中,查找 tts-adapter/kubernetes/deploy.yaml Kubernetes 部署文件,并将其复制到 Voice Gateway 部署目录。

    deploy.yaml 文件包含 Text to Speech Adapter (tts-adapter) 容器的配置信息。每个容器的 env 对象包含了名称/值对的列表,每个名称/值对都与配置环境变量对应。

  2. 创建 Kubernetes 密钥以存储从 Google Cloud 项目下载的凭证 JSON 文件。使用 --from-file 选项指定 Google 凭证文件的路径。

     例如:
    
       kubectl create secret generic google-credentials --from-file=/Users/user1/my-google-project-f4b426929b20.json
    
  3. 通过在 deploy.json 文件的 volumes 部分中指定 Google 凭证文件的名称来将该文件安装到部署。

     例如:
    
     {
       ...
         "volumes": [{
     "name": "google-credentials",
           "secret": {
             "secretName": "google-credentials",
             "items": [{
               "key": "my-google-project-f4b426929b20.json",
               "path": "my-google-project-f4b426929b20.json"
             }]
             }
           }
       ]
     }
    
  4. tts-adapter 容器下,在 GOOGLE_APPLICATION_CREDENTIALS 环境变量中指定 Google 凭证文件位置。

    例如:

       {
         "name": "GOOGLE_APPLICATION_CREDENTIALS",
         "value": "/tts-adapter/credentials/my-google-project-f4b426929b20.json"
       }
    
  5. 通过在 kubectl create 命令中指定部署文件来创建并部署包含 Voice Gateway 容器的 Kubernetes Pod。

     kubectl create -f deploy.yaml
    

    运行此命令会在 Kubernetes 集群中的单个工作程序节点上部署一个 Text To Speech Adapter Pod。

  6. 遵循 将 Voice Gateway 部署到 IBM Cloud Kubernetes Service 中的 Kubernetes 中的步骤,将 Voice Gateway 配置为使用 Text To Speech Adapter。打开 deploy.json 文件并将 Watson Text To Speech 环境变量配置为使用 Text To Speech Adapter:

     {
         "name": "WATSON_TTS_URL",
         "value": "http://tts.adapter:4500"
     }
    
重新部署 Voice Gateway 部署以使更改生效。

后续操作

您可以进一步配置 Voice Gateway 或 Text To Speech 部署,方法是分别编辑 deploy.jsondeploy.yaml 文件以添加或更改配置变量,然后重新部署 Pod。