java
java copied to clipboard
java.net.SocketTimeoutException: Read timed out
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
- Use Java K8s library API's to fetch the configMaps and secrets
- Completed role and role binding to the applications service account
- 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
- 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
- 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
- I am not sure why a curl is working and code is not able to fetch it.