Skip to content

Demo: Service Discovery database connection failed #28

@arslanqadeer

Description

@arslanqadeer

Hi, I'm following your Udemy DevOps course to learn Kubernetes. I came across the following database connection error while following the service discovery Demo.

ubuntu@DESKTOP$kubectl get pods
NAME                                     READY   STATUS    RESTARTS      AGE
database                                 1/1     Running   0             13m
helloworld-deployment-5848ddb496-62pgw   1/1     Running   0             13m
helloworld-deployment-5848ddb496-kghhz   1/1     Running   0             13m
helloworld-deployment-5848ddb496-qdfwz   1/1     Running   1 (12m ago)   13m


ubuntu@DESKTOP$kubectl logs helloworld-deployment-5848ddb496-62pgw
Example app listening at http://:::3000
Error connecting to db:  { [Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client]
  code: 'ER_NOT_SUPPORTED_AUTH_MODE',
  errno: 1251,
  sqlState: '08004',
  fatal: true }

From the quick google search it looks like there is some DB error. But I tried checking the DNS using busybox image and DNS is also not working:

ubuntu@DESKTOP$kubectl get svc
NAME                    TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
database-service        NodePort    10.104.49.168   <none>        3306:31520/TCP   24m
helloworld-db-service   NodePort    10.103.241.63   <none>        3000:30619/TCP   24m
kubernetes              ClusterIP   10.96.0.1       <none>        443/TCP          42h


/ # nslookup helloworld-db-service
Server:         10.96.0.10
Address:        10.96.0.10:53

Name:   helloworld-db-service.default.svc.cluster.local
Address: 10.103.241.63

** server can't find helloworld-db-service.svc.cluster.local: NXDOMAIN

** server can't find helloworld-db-service.cluster.local: NXDOMAIN

** server can't find helloworld-db-service.cluster.local: NXDOMAIN


** server can't find helloworld-db-service.svc.cluster.local: NXDOMAIN

/ #
/ #
/ # nslookup database-service
Server:         10.96.0.10
Address:        10.96.0.10:53

Name:   database-service.default.svc.cluster.local
Address: 10.104.49.168

** server can't find database-service.cluster.local: NXDOMAIN


** server can't find database-service.cluster.local: NXDOMAIN

** server can't find database-service.svc.cluster.local: NXDOMAIN

** server can't find database-service.svc.cluster.local: NXDOMAIN

/ #
/ # cat /etc/resolv.conf
nameserver 10.96.0.10
search default.svc.cluster.local svc.cluster.local cluster.local
options ndots:5

I enabled the "ingress-dns" addon and recreated the deployment, pod and services, however, still not working.
Could you please look into this and let me know what is going on? Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions