Skip to content

Latest commit

 

History

History
43 lines (26 loc) · 1.44 KB

README.md

File metadata and controls

43 lines (26 loc) · 1.44 KB

Dev Container in Kubernetes

Install a dev container inside your cluster, develop and test your application in a real environment.

Description

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.

Usage

  • install required extensions for vscode
    • Dev Container
    • Kubernetes
  • deploy a dev container
  • set kubeconfig
  • select the pod and `Attach Visual Studio Code``

Alt text

For WSL user

🚨 Attach to Container is not working in wsl, see here.

So, you have to install the tools (kubectl, vscode extensions) in your windows machine.

  1. Install kubectl.exe and add into PATH
  2. Set KUBECONFIG into env
$kubeconfig = "C:\Users\your\local\folder\config.yaml"

[System.Environment]::SetEnvironmentVariable("KUBECONFIG", $kubeconfig, "User")
  1. follow the steps above

For storage(cache)

  • workspace cache, for whole user path
  • vscode cache, for extensions