Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud platform 无法从GKE pod连接Redis实例-连接到Redis<;IP:6379>;两次失败后失败。最后一个错误:(110)操作超时_Google Cloud Platform_Redis_Google Kubernetes Engine_Kubernetes Pod - Fatal编程技术网

Google cloud platform 无法从GKE pod连接Redis实例-连接到Redis<;IP:6379>;两次失败后失败。最后一个错误:(110)操作超时

Google cloud platform 无法从GKE pod连接Redis实例-连接到Redis<;IP:6379>;两次失败后失败。最后一个错误:(110)操作超时,google-cloud-platform,redis,google-kubernetes-engine,kubernetes-pod,Google Cloud Platform,Redis,Google Kubernetes Engine,Kubernetes Pod,我使用以下命令创建了GKE集群: $ gcloud container clusters create stage1 \ --enable-ip-alias \ --release-channel stable \ --zone us-central1 \ --node-locations us-central1-a,us-central1-b $ gcloud redis instances create redisbox --size=2 --region=us-centr

我使用以下命令创建了GKE集群:

$ gcloud container clusters create stage1 \
  --enable-ip-alias \
  --release-channel stable \
  --zone us-central1 \
  --node-locations us-central1-a,us-central1-b
$ gcloud redis instances create redisbox --size=2 --region=us-central1 --redis-version=redis_5_0
我还使用以下命令创建了一个redis实例:

$ gcloud container clusters create stage1 \
  --enable-ip-alias \
  --release-channel stable \
  --zone us-central1 \
  --node-locations us-central1-a,us-central1-b
$ gcloud redis instances create redisbox --size=2 --region=us-central1 --redis-version=redis_5_0
我已通过以下方式检索到redis实例的IP地址:

$ gcloud redis instances describe redisbox --region=us-central1
我在PHP应用程序中更新了这个IP,构建了docker映像,在GKE集群中创建了pod。创建pod时,容器抛出以下错误

与Redis:6379的连接在两次失败后失败。上一个错误:(110)操作超时

注1:这是在托管环境中工作的应用程序,我们正在迁移到谷歌云
注2:GKE和Redis实例在同一地区

注3:在集群中启用IP别名

使用
gcloud
命令复制此VPC本机GKE集群和Redis实例后,我可以检查节点及其pod是否可以到达redisbox主机,例如使用
debian:latest
pod中的
ncat

$ REDIS_IP=$(gcloud redis instances describe redisbox --format='get(host)' --region=us-central1)
$ gcloud container clusters get-credentials stage1 --region=us-central1
$ kubectl exec -ti my-debian-pod -- /bin/bash -c "ncat $REDIS_IP 6379 <<<PING"
    +PONG
$REDIS\u IP=$(gcloud REDIS实例描述redisbox--format='get(host)'--region=us-central1)
$gcloud容器群集获取凭据阶段1--区域=us-central1

$kubectl exec-ti my debian pod--/bin/bash-c“ncat$REDIS_IP 6379可能存在端口访问/白名单问题您是否有防火墙规则?您是否使用相同的专有网络?GKE网络策略启用?除了本文中提到的配置,我还没有做过其他配置。我没有创建防火墙规则,也没有启用GKE策略。我所做的是通过提供选项——启用ip别名来创建VPC本机集群。我通过直接从google控制台(无需命令)创建VPC本机集群和redis实例来解决这个问题。我已经获取了创建VPC本机集群的命令,但是没有选择获取创建redis的命令。我将无法使用这种方法,因为我正计划将此过程自动化