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

Unable to call Kubernetes API from pod in cluster running on AWS EKS #37

Closed
tleef opened this issue Jul 23, 2024 · 4 comments · Fixed by #38
Closed

Unable to call Kubernetes API from pod in cluster running on AWS EKS #37

tleef opened this issue Jul 23, 2024 · 4 comments · Fixed by #38

Comments

@tleef
Copy link

tleef commented Jul 23, 2024

In my pod the KUBERNETES_SERVICE_HOST var is set to 172.20.0.1 and KUBERNETES_SERVICE_PORT_HTTPS is set to 443 by default.

When I try to call the API using the FLAMEK8sBackend.K8sClient I get the following error

{:error,
 "failed GET https://172.20.0.1:443/api/v1/namespaces/vial/pods/ with {:failed_connect, [{:to_address, {~c\"172.20.0.1\", 443}}, {:inet, [:inet], {:tls_alert, {:handshake_failure, ~c\"TLS client: In state wait_cert at ssl_handshake.erl:2140 generated CLIENT ALERT: Fatal - Handshake Failure\\n {bad_cert,hostname_check_failed}\"}}}]} [{~c\"Authorization\", ~c\"Bearer <token omitted>"}]"}

As I was trouble shooting this issue, one of the things I tried was reassigning the KUBERNETES_SERVICE_HOST to https://<id-omitted>.sk1.us-west-1.eks.amazonaws.com, the endpoint I use when connecting to the API server externally. This worked!

So the issue appears to be the default KUBERNETES_SERVICE_HOST setting of 172.20.0.1 on EKS clusters.

It's easy enough to workaround this issue but I'm unsure if this is a common problem for EKS users or if I am doing something wrong.

@mruoss
Copy link
Owner

mruoss commented Jul 24, 2024

What OTP version are you running on? Would it be possible for you to upgrade to 27?

See: erlang/otp#7968

@mruoss
Copy link
Owner

mruoss commented Jul 24, 2024

But yeah. After removing req, I might have to add back the fix for older versions of OTP

@tleef
Copy link
Author

tleef commented Jul 24, 2024

I updated to OTP 27.0.1 and it's working now. Thank you!

@tleef tleef closed this as completed Jul 24, 2024
@mruoss
Copy link
Owner

mruoss commented Jul 25, 2024

Reopening this as a reminder to add back the workaround for older versions removed in 1123909

@mruoss mruoss reopened this Jul 25, 2024
@mruoss mruoss linked a pull request Jul 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants