0

私はmicrok8sで作業しており、redisはフラスコのWebページで次のエラーを出すようです:(redisはポッドで、フラスコのWebページは別のポッドにあります)

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