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 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题