connecting to redis using microk8s

3/30/2020

I been working with microk8s and redis seems to give the the follow error on flask webpage:(redis is a pod and flask webpage is in another pod)

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

and I also every so often get CrashLoopBackOff with the below error:

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}]}]}]}]}"

not sure is this related to DNS some how or Grpc

python connection:

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

service yml:

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

deploy:

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

can connect using command:

redis-cli -p 10000
--
grpc
kubernetes
microk8s
redis

1 Answer

3/30/2020

According to your error logs it seems like a problem with the DNS server itself, and not with the record for redis. I am unfamiliar with micro-k8s to know if core-dns or kube-dns is running in kube-system.

-- Derek Lemon
Source: StackOverflow