【发布时间】:2022-01-05 13:17:18
【问题描述】:
是否允许来自 CLI 的端口?
我在 GCP 中有一个实例,并且我安装了一个默认在 Port:8080 上运行的服务。我知道有一个选项可以更改防火墙规则以允许来自 GCP 仪表板的端口,但我想知道是否有任何方法可以允许来自 CLI 的所需端口
就我而言,我使用的是 Git Bash 而不是原生的 GCP Cloud Console
我已经看过允许来自命令行GCP Firewall-rules-from CLI 的端口的文档,但这会抛出ERROR,因为我使用的是Git Bash。
这是错误日志:
[mygcp@foo~]$ gcloud compute firewall-rules create FooService --allow=tcp:8080 --description="Allow incoming traffic on TCP port 8080" --direction=INGRESS
Creating firewall...failed.
ERROR: (gcloud.compute.firewall-rules.create) Could not fetch resource:
- Request had insufficient authentication scopes.
[mygcp@foo~]$ gcloud compute firewall-rules list
ERROR: (gcloud.compute.firewall-rules.list) Some requests did not succeed:
- Request had insufficient authentication scopes.
是否有任何选项可以直接从 Git Bash CLI 允许所需的端口?
【问题讨论】:
-
您是如何设置 gcloud 的?任何 gcloud 命令都有效吗? gcloud 可以在 PowerShell 上运行吗?
-
您是否在 Compute Engine 上运行该命令?
-
@guillaumeblaquiere 是的,那个是 E2 虚拟机。但我已经从 Git Bash 连接到该 VM。
标签: linux google-cloud-platform virtual-machine git-bash google-cloud-iam