Is there a way to specific the google cloud platform project for kubectl in the command?

时间:2016-04-15 15:18:15

标签: kubernetes

Is there something like: kubectl get pods --project=PROJECT_ID

I would like not to modify my default gcloud configuration to switch between my staging and production environment.

2 个答案:

答案 0 :(得分:9)

PFUser *currentUser = [PFUser currentUser]; if (currentUser) { // do stuff with the user } else { // show the signup or login screen } 在其配置中保存群集/上下文。如果使用默认脚本启动群集,则应为clutser设置这些条目。

kubectl的简要概述:

您可以使用kubectl config use-context更改默认上下文,并使用kubectl config切换到当前命令的其他上下文。

答案 1 :(得分:6)

您可以使用带有gcloud container clusters get-credentials标记的--project下载每个群集的凭据。在本地缓存凭据后,您可以使用--context标志(如Yu-Ju在她的回答中所述)在每个命令的集群之间切换。

相关问题