Unable to connect to redis from voting-app pod

I am running kubernetes cluster with minikube (driver: Podman) on my macbook. While doing the voting-app demo with pods, all my resources are successfully deployed. But when I click on vote, I got the internal server error. Upon checking the logs of voting-app-pod, I found out that it is not able to connect to redis pod.

I checked the redis pod. It is up and running and also I exposed it through clusterIp service and service is able to get the pod.

I am getting the same issue for DB in worked & result pod.

Here are the error logs:

Voting-App-Pod Logs:

If anyone has any solution, please let me know.

The error indicates that the voting pod is looking for something using DNS, and failing. Is it possible you have not created the services for the pods? If I run the following, here is what I see:

$ kubectl get service
NAME             TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
db               ClusterIP   10.43.131.59    <none>        5432/TCP       14d
kubernetes       ClusterIP   10.43.0.1       <none>        443/TCP        42d
redis            ClusterIP   10.43.143.164   <none>        6379/TCP       14d
result-service   NodePort    10.43.203.70    <none>        80:30005/TCP   14d
voting-service   NodePort    10.43.155.240   <none>        80:30004/TCP   14d

Thanks @rob_kodekloud for the reply.

I did create the services for the pods. Here is the screenshot for the same.

Also here is the screenshot of the created redis service.

Still, you’re getting the errors you’re getting in the python-based voting container, which are DNS related. Please try the following, to see if DNS is actually working in your cluster:

$ k exec voting-app-pod -- curl -v redis:6379
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 10.43.143.164:6379...
* Connected to redis (10.43.143.164) port 6379 (#0)
> GET / HTTP/1.1
> Host: redis:6379
> User-Agent: curl/7.74.0
> Accept: */*
>
* Empty reply from server
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* Connection #0 to host redis left intact
curl: (52) Empty reply from server
command terminated with exit code 52

I’m not concerned about the error here – an HTTP client is not going to connect correctly with redis – but here notice that DNS resolves, which is correct behavior. The errors you posted suggest something else is going on in your cluster.

Hi @rob_kodekloud ,

After some digging, I implemented some steps to enable DNS resolution from this : Ingress DNS | minikube

It was still not working till the day before yesterday. So I deleted the resources and stopped my minikube cluster and podman machine.

Today, when I start the machine & cluster and recreate the resources to execute the command given by you, it is somehow working now. I don’t know what happened, but somehow DNS resolution seems to be working now.

I am not getting the same error in pod logs now.

I also removed the implemented steps for ingess-dns. But it is still working. I have no clue how it has started working.

If you have any steps to check how DNS resolution is working in pods, I can understand it better.

Never knew what that addon did before. Learn something new everyday is a good thing!