无法从 Kubernetes Engine 连接到 Google Cloud SQL



我有一个 Google Cloud SQL 第二代实例和一个 Google Kubernetes Engine 集群。问题是我无法使用私有 IP 连接到云 SQL。我已经在云 SQL 控制面板中启用了私有 IP,并将其分配给我的 VPC 网络。但是,容器仍然无法连接。

它可能与对等路由有关吗?我需要创建一个吗?

附言。我遵循了本指南 https://cloud.google.com/sql/docs/mysql/connect-kubernetes-engine

gcloud container clusters describe结果:

$ gcloud container clusters describe sirodoht-32-fec8e2914780bf2c
addonsConfig:
  kubernetesDashboard:
    disabled: true
  networkPolicyConfig:
    disabled: true
clusterIpv4Cidr: 10.40.0.0/14
createTime: '2019-05-12T17:07:17+00:00'
currentMasterVersion: 1.12.7-gke.10
currentNodeCount: 6
currentNodeVersion: 1.11.8-gke.6
defaultMaxPodsConstraint:
  maxPodsPerNode: '110'
endpoint: <retracted ip>
initialClusterVersion: 1.11.8-gke.6
initialNodeCount: 1
instanceGroupUrls:
- https://www.googleapis.com/compute/v1/projects/sirodoht-32/zones/europe-west3-a/instanceGroupManagers/gke-sirodoht-32-fep8e29-pool-94e97802-grp
ipAllocationPolicy:
  clusterIpv4Cidr: 10.40.0.0/14
  clusterIpv4CidrBlock: 10.40.0.0/14
  clusterSecondaryRangeName: gke-sirodoht-32-fec8e2914780bf2c-pods-4439d109
  servicesIpv4Cidr: 10.170.0.0/20
  servicesIpv4CidrBlock: 10.170.0.0/20
  servicesSecondaryRangeName: gke-sirodoht-32-fec8e2914780bf2c-services-4439d109
  useIpAliases: true
labelFingerprint: a9dc16a7
legacyAbac: {}
location: europe-west3-a
locations:
- europe-west3-a
loggingService: logging.googleapis.com
maintenancePolicy:
  window:
    dailyMaintenanceWindow:
      duration: PT4H0M0S
      startTime: 00:00
masterAuth:
  clientCertificate: <retracted>
  clientKey: <retracted>
  clusterCaCertificate: <retracted>
monitoringService: monitoring.googleapis.com
name: sirodoht-32-fec8e2914780bf2c
network: compute-network-aaa8ff1ec6b52012
networkConfig:
  network: projects/sirodoht-32/global/networks/compute-network-aaa8ff1ec6b52012
  subnetwork: projects/sirodoht-32/regions/europe-west3/subnetworks/subnet-bb2c9eb79b29a825
nodeConfig:
  diskSizeGb: 100
  diskType: pd-standard
  imageType: COS
  machineType: n1-standard-4
  oauthScopes:
  - https://www.googleapis.com/auth/monitoring
  - https://www.googleapis.com/auth/devstorage.read_only
  - https://www.googleapis.com/auth/logging.write
  - https://www.googleapis.com/auth/service.management.readonly
  - https://www.googleapis.com/auth/servicecontrol
  - https://www.googleapis.com/auth/trace.append
  serviceAccount: default
nodePools:
- config:
    diskSizeGb: 100
    diskType: pd-standard
    imageType: COS
    machineType: n1-standard-4
    oauthScopes:
    - https://www.googleapis.com/auth/monitoring
    - https://www.googleapis.com/auth/devstorage.read_only
    - https://www.googleapis.com/auth/logging.write
    - https://www.googleapis.com/auth/service.management.readonly
    - https://www.googleapis.com/auth/servicecontrol
    - https://www.googleapis.com/auth/trace.append
    serviceAccount: default
  initialNodeCount: 6
  instanceGroupUrls:
  - https://www.googleapis.com/compute/v1/projects/sirodoht-32/zones/europe-west3-a/instanceGroupManagers/gke-sirodoht-32-fep8e29-pool-94e97802-grp
  management: {}
  maxPodsConstraint:
    maxPodsPerNode: '110'
  name: pool
  podIpv4CidrSize: 24
  selfLink: https://container.googleapis.com/v1/projects/sirodoht-32/zones/europe-west3-a/clusters/sirodoht-32-fec8e2914780bf2c/nodePools/pool
  status: RUNNING
  version: 1.11.8-gke.6
selfLink: https://container.googleapis.com/v1/projects/sirodoht-32/zones/europe-west3-a/clusters/sirodoht-32-fec8e2914780bf2c
servicesIpv4Cidr: 10.170.0.0/20
status: RUNNING
subnetwork: subnet-bb2c9eb79b29a825
zone: europe-west3-a
* - There is an upgrade available for your cluster(s).
To upgrade nodes to the latest available version, run
  $ gcloud container clusters upgrade sirodoht-32-fec8e2914780bf2c

私有 IP 只能由同一虚拟私有云 (VPC( 上的其他资源访问。按照这些说明在与您的云 SQL 实例相同的 VPC 上设置 GKE 集群。

有关在云 SQL 上使用私有 IP 的环境要求的更多信息,请参阅此页面。

相关内容

  • 没有找到相关文章

最新更新