通过容器内运行的应用使用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个回答



这似乎是退出的dns pod之一,导致dns查找挂起并导致tcp I / O超时:</ p >

kube-dns-5dcfcbf5fb-w2vjc 0/4 ExitCode:0 23 3d </ code> </ p>

在修复了pod后,现在的应用程序是 能够通过gmail API发送电子邮件。</ p>
</ div>

展开原文

原文

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.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐