Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pod can't access local database with host.minikube.internal #20055

Open
quintin011 opened this issue Dec 6, 2024 · 3 comments
Open

Pod can't access local database with host.minikube.internal #20055

quintin011 opened this issue Dec 6, 2024 · 3 comments
Labels
kind/support Categorizes issue or PR as a support question. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@quintin011
Copy link

quintin011 commented Dec 6, 2024

Hi,

Sorry about my poor English. it will make you feel uncomfortable.

What Happened?

I find issues related minikube can't access my local Postgres DB. but it can ping it and access another service.

Attach the log file

due to grafana cannot up, so I reviews pod logs seem it cannot connect local DB.

kubectl logs grafana-59556c6bb5-q9nbb -ngrafana
logger=settings t=2024-12-06T04:37:27.797283939Z level=info msg="Starting Grafana" version=11.3.1 commit=64b556c137a1d9bcacd19ccb16c4cf138c78ca40 branch=v11.3.x compiled=2024-12-06T04:37:27Z  
logger=settings t=2024-12-06T04:37:27.797486848Z level=info msg="Config loaded from" file=/usr/share/grafana/conf/defaults.ini  
logger=settings t=2024-12-06T04:37:27.797495454Z level=info msg="Config loaded from" file=/etc/grafana/grafana.ini
logger=settings t=2024-12-06T04:37:27.797497848Z level=info msg="Config overridden from command line" arg="default.paths.data=/var/lib/grafana/"
logger=settings t=2024-12-06T04:37:27.797499562Z level=info msg="Config overridden from command line" arg="default.paths.logs=/var/log/grafana"
logger=settings t=2024-12-06T04:37:27.797501459Z level=info msg="Config overridden from command line" arg="default.paths.plugins=/var/lib/grafana/plugins"
logger=settings t=2024-12-06T04:37:27.797502978Z level=info msg="Config overridden from command line" arg="default.paths.provisioning=/etc/grafana/provisioning"
logger=settings t=2024-12-06T04:37:27.797504407Z level=info msg="Config overridden from command line" arg="default.log.mode=console"
logger=settings t=2024-12-06T04:37:27.797505924Z level=info msg="Config overridden from Environment variable" var="GF_PATHS_DATA=/var/lib/grafana/"
logger=settings t=2024-12-06T04:37:27.797507486Z level=info msg="Config overridden from Environment variable" var="GF_PATHS_LOGS=/var/log/grafana"
logger=settings t=2024-12-06T04:37:27.797508954Z level=info msg="Config overridden from Environment variable" var="GF_PATHS_PLUGINS=/var/lib/grafana/plugins"
logger=settings t=2024-12-06T04:37:27.797510368Z level=info msg="Config overridden from Environment variable" var="GF_PATHS_PROVISIONING=/etc/grafana/provisioning"
logger=settings t=2024-12-06T04:37:27.79751189Z level=info msg="Config overridden from Environment variable" var="GF_SECURITY_ADMIN_USER=admin"
logger=settings t=2024-12-06T04:37:27.797513389Z level=info msg="Config overridden from Environment variable" var="GF_SECURITY_ADMIN_PASSWORD=*********"
logger=settings t=2024-12-06T04:37:27.79751506Z level=info msg=Target target=[all]
logger=settings t=2024-12-06T04:37:27.797519042Z level=info msg="Path Home" path=/usr/share/grafana
logger=settings t=2024-12-06T04:37:27.797520624Z level=info msg="Path Data" path=/var/lib/grafana/
logger=settings t=2024-12-06T04:37:27.797522042Z level=info msg="Path Logs" path=/var/log/grafana
logger=settings t=2024-12-06T04:37:27.797523469Z level=info msg="Path Plugins" path=/var/lib/grafana/plugins
logger=settings t=2024-12-06T04:37:27.797524938Z level=info msg="Path Provisioning" path=/etc/grafana/provisioning
logger=settings t=2024-12-06T04:37:27.797526614Z level=info msg="App mode production"
logger=featuremgmt t=2024-12-06T04:37:27.797719935Z level=info msg=FeatureToggles dataplaneFrontendFallback=true kubernetesPlaylists=true prometheusMetricEncyclopedia=true awsAsyncQueryCaching=true cloudWatchCrossAccountQuerying=true groupToNestedTableTransformation=true dashboardScene=true alertingSimplifiedRouting=true influxdbBackendMigration=true recoveryThreshold=true prometheusConfigOverhaulAuth=true alertingNoDataErrorExecution=true openSearchBackendFlowEnabled=true dashboardSceneForViewers=true logsExploreTableVisualisation=true recordedQueriesMulti=true accessControlOnCall=true formatString=true correlations=true ssoSettingsApi=true logsInfiniteScrolling=true cloudWatchRoundUpEndTime=true annotationPermissionUpdate=true logRowsPopoverMenu=true promQLScope=true cloudWatchNewLabelParsing=true panelMonitoring=true notificationBanner=true topnav=true transformationsVariableSupport=true dashgpt=true tlsMemcached=true managedPluginsInstall=true exploreMetrics=true alertingInsights=true angularDeprecationUI=true prometheusAzureOverrideAudience=true lokiMetricDataplane=true dashboardSceneSolo=true lokiStructuredMetadata=true autoMigrateXYChartPanel=true nestedFolders=true lokiQuerySplitting=true lokiQueryHints=true pinNavItems=true publicDashboards=true addFieldFromCalculationStatFunctions=true transformationsRedesign=true logsContextDatasourceUi=true publicDashboardsScene=true       
logger=sqlstore t=2024-12-06T04:37:27.797749668Z level=info msg="Connecting to DB" dbtype=postgres
Error: ✗ read tcp 10.244.0.83:44070->172.29.0.1:5432: read: connection reset by peer

but it tested on Kubernetes of Docker Desktop. it worked by host.docker.internal.
so i don't think wrong deployment configuration.

and I tried connect to local DB by pgAdmin. It's work.

this is logs of minikube: log.txt

I created minikube with containerd by minikube v1.34.0

minikube start --container-runtime=containerd
😄  minikube v1.34.0 on Microsoft Windows 11 Pro 10.0.26100.2314 Build 26100.2314
✨  Using the hyperv driver based on existing profile
[log.txt](https://github.com/user-attachments/files/18034332/log.txt)
👍  Starting "minikube" primary control-plane node in "minikube" cluster
🏃  Updating the running hyperv "minikube" VM ...
❗  Failing to connect to https://registry.k8s.io/ from inside the minikube VM
💡  To pull new external images, you may need to configure a proxy: https://minikube.sigs.k8s.io/docs/reference/networking/proxy/
📦  Preparing Kubernetes v1.31.0 on containerd 1.7.21 ...
🔗  Configuring bridge CNI (Container Networking Interface) ...
🔎  Verifying Kubernetes components...
    ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, default-storageclass
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default

it can ping to localhost

$ ping host.minikube.internal
PING host.minikube.internal (172.29.0.1): 56 data bytes
64 bytes from 172.29.0.1: seq=0 ttl=128 time=0.405 ms
64 bytes from 172.29.0.1: seq=1 ttl=128 time=0.793 ms
64 bytes from 172.29.0.1: seq=2 ttl=128 time=0.436 ms
64 bytes from 172.29.0.1: seq=3 ttl=128 time=0.749 ms
64 bytes from 172.29.0.1: seq=4 ttl=128 time=1.211 ms
^C
--- host.minikube.internal ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss       
round-trip min/avg/max = 0.405/0.718/1.211 ms

and also can access my MinIO service on localhost

$ telnet host.minikube.internal 9000
Connected to host.minikube.internal

but just can not access my Postgres DB on localhost

$ telnet host.minikube.internal 5432
telnet: can't connect to remote host (172.29.0.1): Connection timed out

I find a lot of information on internet but still can't solve it.
May I get different idea for my troubleshoot?

Operating System

Windows

Driver

Hyper-V

@Ritikaa96
Copy link

It seems like tit can't find the postgres DB deployment.
/kind support

@k8s-ci-robot k8s-ci-robot added the kind/support Categorizes issue or PR as a support question. label Dec 11, 2024
@Ritikaa96
Copy link

There are many unhandled Error in your logs, please take a look at them and resolve using the https://minikube.sigs.k8s.io/docs/handbook/troubleshooting/

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

4 participants