Open manojsaxenatda opened 3 years ago
@manojsaxenatda, When using Remote SSH feature of VS Code, did you follow the "Use Kubernetes Service Environment Variables" doc? The default steps would require administrator rights to run a process on remote machine which is not possible. Can you try setting up your project as listed in the above doc I've shared and let me know if you face any issues.
Hi Rakesh
Thanks for your prompt reply. I did setup the task as below:
{
"version": "2.0.0",
"tasks": [
{
"label": "bridge-to-kubernetes.service",
"type": "bridge-to-kubernetes.service",
"service": "halo-appinv",
"ports": [
32238
],
"targetCluster": "kubernetes",
"targetNamespace": "halo-sandbox",
"useKubernetesServiceEnvironmentVariables": true
}
]
}
@manojsaxenatda Along with changing the tasks.json file, after the debugging starts the code should use kubernetes service environment variables to work. But it seems that before that there is an exception in starting a debugging session. I should investigate further about the null ref exception.
For the purpose of testing, I have allowed anyone to modify hosts file, and it didn't change anything as well.
@manojsaxenatda Can you describe how your K8s objects are setup? Does your setup of microservices contain K8s deployment object or just a service & pod combination? If so, there is an issue on our side that needs to looked at further.
In the meantime, to understand and explore more about Bridge To Kubernetes you can try our sample todo project and debug stats-api
service using remote ssh capability.
Hi Rakesh,
Services in our app are deployed in a K8 namespace. Every service has:
@manojsaxenatda Thanks for sharing the details of your setup. Currently Bridge To Kubernetes doesn't support StatefulSets. We have planned it for our current sprint and should be available early April. Thanks!
Thanks for the update,
Describe the bug Failed to establish a connection. Error: Connect operation failed.
To Reproduce I have Linux (RHEL7) dev machine and I connect to this Linux dev box from my Windows10 desktop using “Remote SSH” feature offered by VS Code. I have a three node Kubernetes cluster. I use Kubectl/helm from my Linux dev box to push new code to K8 cluster.
The micro services are hosted in one k8 namespace and each microservice has just one replica pod. There is a nginx ingress controller for cluster, and an ingress rule for each service to route traffic based on Virtual Host to a specific service in given namespace.
This setup is working great for us and I am now trying to setup “Bridge to Kubernetes” so that I can develop/debug microservices efficiently running in a k8 cluster. I have followed the instructions on setting up https://code.visualstudio.com/docs/containers/bridge-to-kubernetes. Kubernetes extension is able to see K8 cluster, namespace, services, pods, …
But when I try to use VS Code to launch my service with Kubernetes, I get the following VS Code pop up error:
"Failed to establish a connection. Error: Connect operation failed. Oops... An unexpected error has occurred. For diagnostic information, see logs at '/tmp/Bridge To Kubernetes'"
**Expected behavior** As described in B2K documentation, I expect tunnel to be established between my dev machine and K8 and inbound traffic to microservice, that I am trying to debug, should flow to my dev machine. **Logs** I have checked K8 logs but don’t see any failures, Attach logs from /tmp/B2K directory: **Bridge-mindarocli.txt** ``` 2021-03-03T22:30:51.1453272Z | MindaroCli | TRACE | Event: Command.Start