duananyantan04633 2018-09-10 00:18
浏览 82
已采纳

通过容器内运行的应用使用Gmail API

I'm wondering how to use Gmail API from an app running inside the container (of GKE)?

For my local development, I can run the example https://developers.google.com/gmail/api/quickstart/go to get a code then the program saves a token, send an email successfully (I've changed the scope, the example only has read-only)

But I don't have the interactive terminal for the container running in K8S, so I set the credentials and token as env var for the process running inside the container (my program consumes the env var, and local testing sent the email successfully), it doesn't seem to be able to contact Gmail API.

The exact error is : Post https://www.googleapis.com/gmail/v1/users/me/messages/send?alt=json&prettyPrint=false: dial tcp: i/o timeout"

So I have two question here:

  1. why is container in GKE is unable to contact www.googleapis.com
  2. What's the best way of handling gmail api inside a container? Am I missing steps to setup google APIs?

Thanks, Bill

  • 写回答

1条回答

  • dqch34769 2018-09-10 02:47
    关注

    It appears to be one of the dns pod exited that caused dns lookup to hang and resulted in tcp i/o timeout:

    kube-dns-5dcfcbf5fb-w2vjc 0/4 ExitCode:0 23 3d

    after fixing the pod, now the application is able to send email thru gmail APIs.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办