java icon indicating copy to clipboard operation
java copied to clipboard

java.net.SocketTimeoutException: Read timed out

Open nikhil4931 opened this issue 2 years ago • 8 comments
trafficstars

Describe the bug Getting SocketTimeoutException Read timed out error when trying to Access K8s Secrets and ConfigMaps.

Client Version Not sure where to get this informatoon

Kubernetes Version 13.0.2

Java Version Java 17

To Reproduce

  1. Use Java K8s library API's to fetch the configMaps and secrets
  2. Completed role and role binding to the applications service account
  3. After deploying the application, It's failing to get the secrets and throwing SocketTimeoutException

Expected behavior Expected behavior is to get configMaps and secrets successfully

KubeConfig If applicable, add a KubeConfig file with secrets redacted.

Server (please complete the following information):

  • OS: [e.g. Linux]
  • Docker container
  • OCI

Additional context

  1. I was able to SSH into pod via kubectl and I can confirm I can see all the required details in /var/run/secrets/kubernetes.io/serviceaccount/token
  2. I executed this curl and it's working fine token=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) curl -v --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt -H "Authorization: Bearer $token" https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_PORT_443_TCP_PORT/api/v1/namespaces/{namespace}/configmaps/{name} removed actual namespace details
  3. I am not sure why a curl is working and code is not able to fetch it.

nikhil4931 avatar Jul 18 '23 14:07 nikhil4931