Skip to content

SocketTimeoutException when connecting #581

@ChrisMullard

Description

@ChrisMullard

Hi,
I have three Kubernetes clusters in AWS - these all constructed from a script so should be effectively identical. The generated K8 configs allow Kubernetes Dashboard connections with no issues (and kubectl commands work fine to all 3 too)

However making an API connection (using the same configs) to the cluster doesn't work for one of them and I've no why. The other two work fine.

Java code:

            ApiClient client = Config.fromConfig(configFile);
            client.getHttpClient().setReadTimeout(60, TimeUnit.SECONDS);
            Configuration.setDefaultApiClient(client);              

            ExtensionsV1beta1Api extApi = new ExtensionsV1beta1Api();
            ExtensionsV1beta1DeploymentList list = extApi.listNamespacedDeployment("monitoring", false, "false", null, null, null, null, null, 10000,
                    null);
            for (ExtensionsV1beta1Deployment item : list.getItems()) {
                logger.info(region + " " + item.getMetadata().getName() + " " + item.getStatus().getAvailableReplicas());
            }

For the cluster it doesn't work for I get a timeout:

io.kubernetes.client.ApiException: java.net.SocketTimeoutException: connect timed out
at io.kubernetes.client.ApiClient.execute(ApiClient.java:801)
at io.kubernetes.client.apis.ExtensionsV1beta1Api.listNamespacedDeploymentWithHttpInfo(ExtensionsV1beta1Api.java:4219)
at io.kubernetes.client.apis.ExtensionsV1beta1Api.listNamespacedDeployment(ExtensionsV1beta1Api.java:4196)
Caused by: java.net.SocketTimeoutException: connect timed out
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)

Is there any way to get more information about why the API cannot connect?
Thanks

Versions of client and cluster:
Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.0", GitCommit:"0ed33881dc4355495f623c6f22e7dd0b7632b7c0", GitTreeState:"clean", BuildDate:"2018-09-27T17:05:32Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"windows/amd64"}

Server Version: version.Info{Major:"1", Minor:"12+", GitVersion:"v1.12.6-eks-d69f1b", GitCommit:"d69f1bf3669bf00b7f4a758e978e0e7a1e3a68f7", GitTreeState:"clean", BuildDate:"2019-02-28T20:26:10Z", GoVersion:"go1.10.8", Compiler:"gc", Platform:"linux/amd64"}

The server versions are the same for all three clusters

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions