Skip to content

ArgumentError in K8s.Client.Mint.ConnectionRegistry on TCP Connection #312

@Rshep3087

Description

@Rshep3087

Description

Encountering an ArgumentError when K8s.Client.Mint.ConnectionRegistry attempts to establish a TCP connection via the Mint library. This issue leads to the termination of the GenServer managing the connections.

Error Message and Stack Trace

11:52:26.810 [error] GenServer K8s.Client.Mint.ConnectionRegistry terminating
** (ArgumentError) argument error
    (kernel 9.0.2) gen_tcp.erl:227: :gen_tcp.connect/4
    (mint 1.5.2) lib/mint/core/transport/tcp.ex:41: Mint.Core.Transport.TCP.connect/3
    (mint 1.5.2) lib/mint/http1.ex:133: Mint.HTTP1.connect/4
    (k8s 2.6.0) lib/k8s/client/mint/connection_registry.ex:107: K8s.Client.Mint.ConnectionRegistry.handle_call/3
    (stdlib 5.0.2) gen_server.erl:1113: :gen_server.try_handle_call/4
    (stdlib 5.0.2) gen_server.erl:1142: :gen_server.handle_msg/6
    (stdlib 5.0.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.98.0>): {:get_or_open, {:http, "localhost", 18450, [transport_opts: [verify: :verify_none, cacertfile: ~c"/Users/ryan/Library/Caches/mix/installs/elixir-1.15.4-erts-14.0.2/be31dcf1afec9e679df0d6bfbc58eed4/_build/dev/lib/castore/priv/cacerts.pem"]]}}
State: {%{}, %{}}
Client #PID<0.98.0> is alive

    (stdlib 5.0.2) gen.erl:240: :gen.do_call/4
    (elixir 1.15.4) lib/gen_server.ex:1071: GenServer.call/3
    (k8s 2.6.0) lib/k8s/client/mint/connection_registry.ex:53: K8s.Client.Mint.ConnectionRegistry.checkout/1
    (k8s 2.6.0) lib/k8s/client/mint_http_provider.ex:80: K8s.Client.MintHTTPProvider.do_stream_to/6
    (k8s 2.6.0) lib/k8s/client/mint_http_provider.ex:34: K8s.Client.MintHTTPProvider.stream/5
    (k8s 2.6.0) lib/k8s/client/mint_http_provider.ex:16: K8s.Client.MintHTTPProvider.request/5
    (k8s 2.6.0) lib/k8s/discovery/driver/http.ex:17: K8s.Discovery.Driver.HTTP.resources/3
    (k8s 2.6.0) lib/k8s/discovery/resource_finder.ex:38: K8s.Discovery.ResourceFinder.find_resource/3

Steps to Reproduce

  1. Run as an elixir script
Mix.install([{:k8s, "~> 2.0"}])

{:ok, conn} =
  K8s.Conn.from_file("~/.kube/config",
    insecure_skip_tls_verify: true
  )

operation = K8s.Client.list("apps/v1", "Deployment", namespace: "default")

{:ok, deployments} = K8s.Client.run(conn, operation)

IO.inspect(deployments)

Environment

❯ elixir --version
Erlang/OTP 26 [erts-14.0.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]

Elixir 1.15.4 (compiled with Erlang/OTP 26)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions