0

我一直在使用 microk8s,redis 似乎在烧瓶网页上出现以下错误:(redis 是一个 pod,flask 网页在另一个 pod 中)

connecting to redis:6379. Temporary failure in name resolution.

而且我也经常遇到以下错误的 CrashLoopBackOff:

grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
    status = StatusCode.UNAVAILABLE
    details = "DNS resolution failed"
    debug_error_string = "{"created":"@1585584578.284600062","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":3941,"referenced_errors":[{"created":"@1585584578.284535859","description":"Resolver transient failure","file":"src/core/ext/filters/client_channel/resolving_lb_policy.cc","file_line":262,"referenced_errors":[{"created":"@1585584578.284532411","description":"DNS resolution failed","file":"src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc","file_line":370,"grpc_status":14,"referenced_errors":[{"created":"@1585584578.284452899","description":"C-ares status is not ARES_SUCCESS: Timeout while contacting DNS servers","file":"src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc","file_line":244,"referenced_errors":[{"created":"@1585584578.284444557","description":"C-ares status is not ARES_SUCCESS: Timeout while contacting DNS servers","file":"src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc","file_line":244}]}]}]}]}"

不确定这是否与 DNS 有关或 Grpc

蟒蛇连接:

  conn = redis.StrictRedis(host='redis', port=6379)

服务 yml:

apiVersion: v1
kind: Service
metadata:
  labels:
    app: redis
  name: redis
spec:
  selector:
    app: redis
  type: NodePort
  ports:
  - port: 6379
    nodePort: 10000
    protocol: TCP

部署:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: redis-deploy
spec:
  selector:
    matchLabels:
      app: redis
  template:
    metadata:
      labels:
        app: redis
    spec:
      containers:
      - name: redis
        image: redis:alpine
        ports:
        - containerPort: 6379

可以使用命令连接:

redis-cli -p 10000
4

1 回答 1

0

根据您的错误日志,这似乎是 DNS 服务器本身的问题,而不是redis. 我不熟悉 micro-k8s 以了解 core-dns 或 kube-dns 是否在 kube-system 中运行。

于 2020-03-30T20:58:10.567 回答