Environment variable KUBERNETES_SERVICE_HOST not redirected to the host
coderyangyangyang opened this issue · 0 comments
Describe the bug
I use mac vscode Kubernetes and import the kubeconfig file to add a remote k8s cluster, and use Bridge to Kubernetes debug local. due to my service using k8s go client to create the k8s job, the environment variable KUBERNETES_SERVICE_HOST is needed, the kubernetes service dns is redirected to the host, but environment variable KUBERNETES_SERVICE_HOST is not redirected to the host, it's remote host ip, we set the jump server, so remote host port cannot connect derectly, so I got connection refused error when creating a k8s cleint in my program.
version info
vscode Bridge to Kubernetes v2.0.120240111
vscode Kubernetes v1.3.15
MacOS 13.5
Logs:
Deployment 'default/fine-tuning-job-service' patched to run agent.
Remote agent deployed in container 'fine-tuning-job-service' in pod 'fine-tuning-job-service-855bdb64db-q74sd'.
Preparing to run Bridge To Kubernetes configured as pod default/fine-tuning-job-service-855bdb64db-q74sd ...
Connection established.
Hosts file updated.
Service 'model-management-service' is available on 127.1.1.1:8080.
Service 'model-management-service' is available on 127.1.1.1:8081.
Service 'model-management-service' is available on 127.1.1.1:8082.
Service 'chatbot-service' is available on 127.1.1.9:8022.
Service 'kubernetes' is available on 127.1.1.10:443. // redirected to host
Service 'chatbot-demo' is available on 127.1.1.11:8022.
Container port 8090 is available at localhost:5567.
Container port 8091 is available at localhost:null.
Container port 8092 is available at localhost:null.
Downloading volume 'kube-api-access-5wv92' from '/var/run/secrets/kubernetes.io/serviceaccount' ...
Downloading from '/var/run/secrets/kubernetes.io/serviceaccount' ...
Download completed.
##################### Environment started. #############################################################
Run /var/folders/cd/rz2jslxd40b3nyt0w8l6n645jq3w_7/T/tmp-28101CsVEicjVgl0M.env.cmd in your existing console to also get connected.
Service connected: fine-tuning-job-service
Local service IPs:
Local DNS service is not running.
Environment variables:
KUBERNETES_PORT_443_TCP_ADDR=xxx.xx.xx.163 // remote server ip
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_SERVICE_PORT_HTTPS=443
KUBERNETES_PORT=tcp://xxx.xx.xx.163:443
KUBERNETES_SERVICE_PORT=443
KUBERNETES_PORT_443_TCP=tcp://xxx.xx.xx.163:443
KUBERNETES_SERVICE_HOST=xxx.xx.xx.163
KUBERNETES_PORT_443_TCP_PORT=443