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
bug: k8s service discovery error: not found environment variable KUBERNETES_SERVICE_HOST #6830
Comments
@spinachomes By default, APISIX doesn't recognize extra environment variables, please add this env to https://github.com/apache/apisix/blob/master/conf/config-default.yaml#L172. |
By the way, if this way helps you to resolve the problem, could you also help to optimize the doc of kubernetes discovery? |
We can inject the env variable when k8s service discovery is enabled? Line 640 in b2184d8
|
maybe i can get it done this weekend |
thanks, I will try |
Sorry, I received a temporary assignment from my boss and I need to take up weekend time. |
Current Behavior
k8s discovery can't get KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT from ENV
but in pod I can echo KUBERNETES_SERVICE_HOST var.
Expected Behavior
No response
Error Logs
2022/04/12 07:22:00 [error] 48#48: init_worker_by_lua error: /usr/local/apisix/apisix/discovery/kubernetes/init.lua:342: not found environment variable KUBERNETES_SERVICE_HOST
stack traceback:
[C]: in function 'error'
/usr/local/apisix/apisix/discovery/kubernetes/init.lua:342: in function 'init_worker'
/usr/local/apisix/apisix/discovery/init.lua:35: in function 'init_worker'
/usr/local/apisix/apisix/init.lua:109: in function 'http_init_worker'
init_worker_by_lua:2: in main chunk
Steps to Reproduce
1.install apisix use helm apisix-helm-chart
2.add discovery:kubernetes: { } in apisix configmap
3.k logs -f po
Environment
apisix version
):2.13.0uname -a
):Linux hecs-x-large-4-linux-20200603165605 3.10.0-1160.53.1.el7.x86_64 change: added doc of how to load plugin. #1 SMP Fri Jan 14 13:59:45 UTC 2022 x86_64 x86_64 x86_64 GNU/Linuxopenresty -V
ornginx -V
):curl http://127.0.0.1:9090/v1/server_info
):luarocks --version
):The text was updated successfully, but these errors were encountered: