276. GKE私有叢集設定 Authorized networks,出現錯誤 private_endpoint_enforcement_enabled cannot be disabled on VPC peering based clusters

WHY

3/25 看到一個文章用於K8s的Ingress Nginx Controller存在重大漏洞,6,500個叢集恐曝險
然後就炸了。
後來查了一下攻擊的方式,
就再把GKE的安全性拉高點吧。

NOTE

如果Cluster有 VPC peering,
設定完 Authorized networks ,要存檔時會直接噴錯。
276-fig.1.png

記得要把Enforce authorized networks on the control plane's internal endpoint 開啟。

指令的話,則是。

gcloud container clusters update <cluster_name> \
  --project=<project> \
  --enable-master-authorized-networks \
  --master-authorized-networks=<YOUR_IP_RANGE>