0

我正在尝试将我的 Google 存储凭据包含在我的 Dockerfile 中,这样我就不必每次在 Kubernetes 中创建新 Pod 或另一个死机时都这样做。那么有没有办法像这样放置这个命令

 gsutil config -a (Access Key) (Secret)

而不是运行命令

 gsutil config -a

然后手动插入(访问密钥)和(秘密)。

谢谢

4

1 回答 1

0

您可以使用传递输入echo并将其通过管道传递给gsutil.

请记住为什么该gsutil命令不接受命令行参数 - 命令存储在 shell 的历史文件中,如果它们包含这些秘密作为命令行参数,则很容易泄露您的秘密。

因此,以下命令将存储在 shell 历史记录中(除非您以其他方式阻止它)并且可能包含您的秘密。

$ echo -e "$ACCESS_KEY_ID\n$ACCESS_KEY_SECRET\n" | gsutil config -a

This command will configure HMAC credentials, but gsutil will use
OAuth2 credentials from the Cloud SDK by default. To make sure the
HMAC credentials are used, run: "gcloud config set
pass_credentials_to_gsutil false".

This command will create a boto config file at /Users/tuxdude/.boto
containing your credentials, based on your responses to the following
questions.

Boto config file "/Users/tuxdude/.boto" created. If you need to use a
proxy to access the Internet please see the instructions in that file.
What is your google access key ID? What is your google secret access key?
于 2017-06-09T03:32:20.757 回答