0

我試圖在我的Dockerfile中包含我的Google存儲的憑據,這樣我就不必每次都在Kubernetes中創建一個新的Pod或另一個模塊時執行此操作。 那麼,有沒有把這個命令是這樣雲SDK命令gsutil配置-a

gsutil config -a (Access Key) (Secret) 

,而不是運行命令

gsutil config -a 

,然後插入(訪問密鑰)的方式和(祕密)手動。

感謝

回答

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? 
+0

非常感謝你的幫助我很欣賞它 – montatich