我有一个想要连接到 Redis 的 pod,但是我们改用 dragonfly,但它无法做到这一点。
[2024-04-01 14:34:28.421 DEBUG common_server/src/db/redis_manager.rs:112] creating redis pool with CLIENT NAME: rust-rpauth-5b56497fcf-nz8gt|strict|2
[2024-04-01 14:34:34.444 ERROR common_server/src/db/redis_manager.rs:468] connection error in rust-rpauth-5b56497fcf-nz8gt|strict|2 : failed to lookup address information: Name or service not known
[2024-04-01 14:34:53.657 ERROR common_server/src/db/redis_manager.rs:468] connection error in rust-rpauth-5b56497fcf-nz8gt|strict|2 : failed to lookup address information: Name or service not known
[2024-04-01 14:34:53.659 ERROR common_server/src/db/redis_manager.rs:468] connection error in rust-rpauth-5b56497fcf-nz8gt|strict|2 : failed to lookup address information: Name or service not known
thread 'main' panicked at common_server/src/db/redis_manager.rs:120:14:
failed to create new redis pool: Error(Some("failed to lookup address information: Name or service not known"))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[2024-04-01 14:34:58.421 DEBUG common_server/src/providers/dispatch_data.rs:124] Dropping ServiceData
检查了服务-它有效:
kubectl get endpoints -nrp-dev-dragonfly
NAME ENDPOINTS AGE
dragonfly 10.46.0.7:6379 4d23h
---
kubectl port-forward svc/dragonfly 6379:6379 -n rp-dev-dragonfly
Forwarding from 127.0.0.1:6379 -> 6379
Forwarding from [::1]:6379 -> 6379
Handling connection for 6379
我使用 Ubuntu 创建了一个简单的 pod,只是为了测试我的服务是否可见nslookup
(第二和第三张截图)
root@ubuntu:/# nslookup dragonfly.rp-dev-dragonfly.svc.cluster.local
Server: 10.80.0.10
Address: 10.80.0.10#53
** server can't find dragonfly.rp-dev-dragonfly.svc.cluster.local: NXDOMAIN
root@ubuntu:/#
root@ubuntu:/#
root@ubuntu:/# cat /etc/resolv.conf
nameserver 10.80.0.10
search rp-dev.svc.cluster.local svc.cluster.local cluster.local
options ndots:5
root@ubuntu:/#
而相同的服务在具有相同服务的其他集群中可以通过相同的命令轻松看到,并且使用相同的清单进行部署。
我已经为这个问题苦苦挣扎了两天了,但我仍然不知道该往哪个方向看。提前感谢你的帮助)