Install a dev container inside your cluster, develop and test your application in a real environment.
Devcontainers is a remote development environment, you can use vscode to connect to a remote server, and use the server's resources to develop your code. When you run it in a kubernetes cluster, you can use the cluster's resources(compute, network, storage) and develop a true 'cloud-native' application.
VSCode (client) will interact with the dev container(pod) in the cluster, via kubectl and kube-proxy. So you don't need to open any port for the deployment.
- install required extensions for vscode
- Dev Container
- Kubernetes
- deploy a dev container
- set kubeconfig
- select the pod and `Attach Visual Studio Code``
🚨 Attach to Container is not working in wsl, see here.
So, you have to install the tools (kubectl, vscode extensions) in your windows machine.
- Install kubectl.exe and add into
PATH
- Set KUBECONFIG into env
$kubeconfig = "C:\Users\your\local\folder\config.yaml"
[System.Environment]::SetEnvironmentVariable("KUBECONFIG", $kubeconfig, "User")
- follow the steps above
- workspace cache, for whole user path
- vscode cache, for extensions