Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
830 views
in Technique[技术] by (71.8m points)

google cloud platform - Unable to connect Redis Instance from GKE pod - Connection to Redis <IP:6379 >failed after 2 failures.Last Error : (110) Operation timed out

I have GKE cluster that I created with following command:

$ gcloud container clusters create stage1 
  --enable-ip-alias 
  --release-channel stable 
  --zone us-central1 
  --node-locations us-central1-a,us-central1-b

and I also created a redis instance with following command:

$ gcloud redis instances create redisbox --size=2 --region=us-central1 --redis-version=redis_5_0

I have retrieved the IP address of the redis instance with:

$ gcloud redis instances describe redisbox --region=us-central1

I have updated this IP in my PHP application, built my docker image , created the pod in GKE cluster. When pod is created the container throws following error

Connection to Redis :6379 failed after 2 failures.Last Error : (110) Operation timed out

Note 1: This is working application in hosted environment and we are migrating to Google Cloud
Note 2: GKE and Redis instance is in same region
Note 3: Enabled IP aliasing in cluster


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

After reproducing this VPC-native GKE cluster and Redis instance with your gcloud commands, I could check that both the nodes and their pods can reach the redisbox host, for example with ncat in a debian:latest pod:

$ 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

Therefore, I suggest that you try performing this lower-level reachability test in case there there is an issue with the specific request that your PHP application is doing.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...