在 Kubernetes 集群上部署 VSCode
在 Kubernetes 集群上部署 VSCodeVisual Studio Code
Visual Studio Code 是一个轻量级但功能强大的源代码编辑器,可在您的桌面上运行,适用于 Windows、macOS 和 Linux。它内置了对 JavaScript、TypeScript 和 Node.js 的支持,并为其他语言(如 C++、C#、Java、Python、PHP、Go)和运行时(如 .NET 和 Unity)提供了丰富的扩展生态系统.
开发工具来说云端 IDE 也逐渐受到大家重视,Visual Studio Code 有官方web版本,由于访问不太稳定可以借助Code-Server部署在本地环境。
官方地址:https://vscode.dev/
传统方式安装
# 安装curl -fsSL https://code-server.dev/install.sh | sh# 查看配置cat .config/code-server/config.yaml bind-addr: 0.0.0.0:8080auth: passwordpassword: c5d4b8deec690d04e81ef0d5cert: falsedocker方式安装
# 启用容器mkdir -p ~/.configdocker run -d --name code-server\-p 8080:8080 \-v "$HOME/.config:/home/coder/.config" \-v "$PWD:/home/coder/project" \-u "$(id -u):$(id -g)" \-e "DOCKER_USER=$USER"\codercom/code-server:latest# 查看密码docker exec -it code-servercat ~/.config/code-server/config.yamlbind-addr: 127.0.0.1:8080auth: passwordpassword: cca029c905426a228d46d3eacert: falsekubernetes方式安装
apiVersion: v1kind: Namespacemetadata:name: code-server---apiVersion: v1kind: Servicemetadata:name: code-servernamespace: code-serverspec:type: NodePortselector: app: code-serverports:- port: 80 targetPort: 8080---apiVersion: apps/v1kind: Deploymentmetadata:name: code-servernamespace: code-serverlabels: app: code-serverspec:replicas: 3strategy: rollingUpdate: maxSurge: 3 maxUnavailable: 3 type: RollingUpdateselector: matchLabels: app: code-servertemplate: metadata: labels: app: code-server spec: containers: - name: code-server image: codercom/code-server imagePullPolicy: IfNotPresent env: - name: PASSWORD value: "123123" resources: limits: memory: "512Mi" cpu: "4096m" ports: - containerPort: 8080kubernetes方式验证测试
kubectlget svc -n code-server NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEcode-server NodePort 10.97.52.132 <none> 80:31274/TCP 2d21hcurl -I 192.168.1.61:31274HTTP/1.1 302 FoundLocation: ./loginVary: Accept, Accept-EncodingContent-Type: text/plain; charset=utf-8Content-Length: 29Date: Mon, 13 Jun 2022 01:11:16 GMTConnection: keep-aliveKeep-Alive: timeout=5
关于
https://www.oiox.cn/
https://www.oiox.cn/index.php/start-page.html
CSDN、GitHub、知乎、微信公众号、开源中国、思否、掘金、简书、华为云、阿里云、腾讯云、哔哩哔哩、今日头条、新浪微博、个人博客、全网可搜《小陈运维》
文章主要发布于微信公众号
页:
[1]