-
Notifications
You must be signed in to change notification settings - Fork 164
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
isDocker is not working on Kubernetes v1.23 #579
Comments
I would say it is a upstream issue. and you are allowed to pass the address by yourself. |
I would say that isDocker works as expected since K8s doesn't implement a Docker engine, but it would be nice if the fastify-cli adds some detection logic to use 0.0.0.0 as default in K8s environments. I lost 2h yesterday because of this |
Ah! That's the catch. Do you know how can we detect that we running on K8s? |
Seems like you can check for an environment variable: https://stackoverflow.com/questions/36639062/how-do-i-tell-if-my-container-is-running-inside-a-kubernetes-cluster |
Would you accept a PR for this? |
Yes, and I see more complete check on this package https://github.com/ntfs32/is-kubernetes/blob/main/index.js |
Ok, I'll propose a PR then. Though I would be against adding an external dependency for something that is a 1-liner, as the environment variable is enough (according to the docs, it's always present: https://kubernetes.io/docs/tutorials/services/connect-applications-service/#environment-variables). |
I have no idea will this change in future but multiple method for detection doesn't hurt. |
Given that any change to this would break the entire k8s ecosystem, it's very unlikely. I've sent the PR BTW. |
The check is When a environment really doesn't set one, then the application is no-way out either. Even worse then consuming sometime for reading file-system. |
Prerequisites
Fastify version
4.1.1
Plugin version
No response
Node.js version
16
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
20.04
Description
Plugin is docker is not work on EKS (Elastic Kubernetes Service) 1.23
Steps to Reproduce
Run app in EKS as pod
Observe the log that it is running on 127.0.0.1
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: