google-compute-engine - 到虚拟机的 IAP 隧道
问题描述
我有一个关于 Compute VM 及其相关权限的问题。我在项目级别拥有“所有者”权限。我创建了一个 VM,但无法为其分配外部 IP 地址。参考谷歌云文档后,看来我仍然可以使用 VPN 或 IAP 连接到此 VM。单击 VM 旁边的 SSH 链接后,我看到它使用 Cloud-IAP 隧道,但连接失败。
这是错误消息 External IP address was not found; 默认使用 IAP 隧道。
ERROR: (gcloud.compute.start-iap-tunnel) Error while connecting [4003: u'failed to connect to backend'].
ssh_exchange_identification: Connection closed by remote host
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].
我该如何连接到这个虚拟机?
感谢您对此的帮助
解决方案
- https://hodari.be/posts/2019_09_30_access_private_gke_nodes_with_ssh/
- https://cloud.google.com/iap/docs/using-tcp-forwarding
防火墙规则配置为允许从您计算机的所有端口上的 Cloud IAP 的 TCP 转发网络块 35.235.240.0/20 进行访问。这可确保允许从 Cloud IAP 的 TCP 转发 IP 地址到资源上管理服务的 TCP 端口的连接。请注意,如果将 default-allow-ssh 和 default-allow-rdp 默认规则应用于用于 SSH 和 RDP 的端口,您可能不需要调整防火墙规则。
可能您已经拥有default-allow-ssh
而不是尝试:
gcloud compute start-iap-tunnel stage-es-kibana 5601 --local-host-port=localhost:5601
通过额外的 ssh 层跳转到端口:
gcloud compute ssh stage-es-kibana -- -N -L 5601:localhost:5601
stage-es-kibana:5601
或在 host/port和 subnet之间打开 Google Firewall 35.235.240.0/20
。
推荐阅读
- javascript - 让用户在edittext中输入一个简单的文本,然后在更多页面的textview中显示如何R.id string sharedpreferences
- java - 无法在 macOS 上执行 JavaFX 示例:未找到工具包
- java - 通过反射更改原始类型(例如长而不是长)的拆箱
- python - 非平稳性是什么意思以及如何在强化学习中将其实现为 10 臂老虎机问题?
- android - Android Firestore 使用 where 子句删除子项
- java - Java 11:使用 JavaCompiler 以编程方式编译代码很慢
- python - Python多处理需要更长的时间
- java - Java AES 加密 - 幕后
- vb.net - 实时共享某人时如何查看 VB.net Designer
- python - 如何绘制指数函数的曲线