UPDATE. I completely missed Antoine Toussaint's prior issue 506, AntoineToussaint.
He diagnosed the same things. His proposed fix is the better one, however, my one line fix to the DNS issue, see #5 below, gets things going quickly. Like he found, I also did also need to make a slight adjustment to the go import to correctly import simpleredis. It needs to be imported as: github.com/xyproto/simpleredis/v2
Original Issue:
It's possible this issue is a bug in the guestbook-go example. Or, maybe it is just a problem with Docker Desktop K8s, which is what i was using. I don't know. I'm creating the issue to possibly help others who run into the same problem.
The go program in guestbook-go/main.go shows this panic after adding list items in the guestbook (and the items never show in the web app):
Using dnsutils via kubectl exec -i -t dnsutils -- nslookup redis-slave shows:
Server: 10.96.0.10
Address: 10.96.0.10#53
** server can't find redis-slave: SERVFAIL
command terminated with exit code 1
Logs from kube-dns, via kubectl logs --namespace=kube-system -l k8s-app=kube-dns show:
[INFO] 10.1.0.67:35518 - 32059 "A IN redis-slave.svc.cluster.local. udp 47 false 512" NXDOMAIN qr,aa,rd 140 0.000136801s
[INFO] 10.1.0.67:48817 - 11700 "AAAA IN redis-slave.cluster.local. udp 43 false 512" NXDOMAIN qr,aa,rd 136 0.0000953s
[INFO] 10.1.0.67:34640 - 708 "A IN redis-slave.cluster.local. udp 43 false 512" NXDOMAIN qr,aa,rd 136 0.0000894s
[INFO] 10.1.0.67:33927 - 62058 "A IN redis-slave. udp 29 false 512" - - 0 2.001422668s
[ERROR] plugin/errors: 2 redis-slave. A: read udp 10.1.0.50:44112->192.168.65.7:53: i/o timeout
However, redis-master (from redis-master-service.yaml), does resolve (i.e. DNS is working, in some fashion), per kubectl exec -i -t dnsutils -- nslookup redis-master
A one line change fixes this for me. (Not saying this is the right thing to do for the whole example for everyone--I'd have to research more--but it might help other Docker Desktop K8S users to get the example working, if they are experiencing the same problem).
If I change the service name in redis-replica-service.yaml on line 4 to
name: redis-slave
the web app starts working (displaying added items) and the DNS errors stop.
Additional Info on versions/systems I used and changes I made to the example. (I have not tried this with a K8S other than Docker Desktop's built-in).
System versions
Docker Desktop 4.24.1 (123237)
Docker Engine v24.0.6
Kubernetes (Bundled with Docker Desktop) 1.27.2
Windows 11 system (However I was developing inside a Debian derived dev container hosted in Docker with a WSL 2 backend.
Code changes
This version of Docker Engine is always using docker buildx when docker build is invoked, so I changed guestbook-go/Makefile to use 'docker build', not 'docker buildx'
The example is fairly stale--to get it to build, I changed the import of simpleredis in guestbook-go/main.go to use v2 (following is the changed line within import list): simpleredis "github.com/xyproto/simpleredis/v2". I made the same change (adding '/v2') at line 18 in "guestbook-go/Makefile"
UPDATE. I completely missed Antoine Toussaint's prior issue 506, AntoineToussaint. He diagnosed the same things. His proposed fix is the better one, however, my one line fix to the DNS issue, see #5 below, gets things going quickly. Like he found, I also did also need to make a slight adjustment to the go import to correctly import simpleredis. It needs to be imported as: github.com/xyproto/simpleredis/v2
Original Issue: It's possible this issue is a bug in the guestbook-go example. Or, maybe it is just a problem with Docker Desktop K8s, which is what i was using. I don't know. I'm creating the issue to possibly help others who run into the same problem.
The go program in
guestbook-go/main.go
shows this panic after adding list items in the guestbook (and the items never show in the web app):Using dnsutils via
kubectl exec -i -t dnsutils -- nslookup redis-slave
shows:Logs from kube-dns, via
kubectl logs --namespace=kube-system -l k8s-app=kube-dns
show:However, redis-master (from
redis-master-service.yaml
), does resolve (i.e. DNS is working, in some fashion), perkubectl exec -i -t dnsutils -- nslookup redis-master
A one line change fixes this for me. (Not saying this is the right thing to do for the whole example for everyone--I'd have to research more--but it might help other Docker Desktop K8S users to get the example working, if they are experiencing the same problem).
If I change the service name in
redis-replica-service.yaml
on line 4 toname: redis-slave
the web app starts working (displaying added items) and the DNS errors stop.
Additional Info on versions/systems I used and changes I made to the example. (I have not tried this with a K8S other than Docker Desktop's built-in).
System versions
Docker Desktop 4.24.1 (123237) Docker Engine v24.0.6 Kubernetes (Bundled with Docker Desktop) 1.27.2 Windows 11 system (However I was developing inside a Debian derived dev container hosted in Docker with a WSL 2 backend.
Code changes
This version of Docker Engine is always using docker buildx when docker build is invoked, so I changed
guestbook-go/Makefile
to use 'docker build', not 'docker buildx' The example is fairly stale--to get it to build, I changed the import of simpleredis inguestbook-go/main.go
to use v2 (following is the changed line within import list):simpleredis "github.com/xyproto/simpleredis/v2"
. I made the same change (adding '/v2') at line 18 in "guestbook-go/Makefile"