K8s中部署VS Code web版本

PVC

1
2
3
4
5
6
7
8
9
10
11
12
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: code-server
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: "640Gi"
volumeName:
storageClassName: nfs

Service

1
2
3
4
5
6
7
8
9
10
11
12
13
apiVersion: v1
kind: Service
metadata:
name: code-server
namespace: sre
spec:
type: NodePort
ports:
- port: 8080
targetPort: 8080
nodePort: 30028
selector:
app: code-server

Deployment

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: code-server
name: code-server
namespace: sre
spec:
selector:
matchLabels:
app: code-server
template:
metadata:
labels:
app: code-server
spec:
containers:
- image: codercom/code-server
imagePullPolicy: IfNotPresent
name: code-server
ports:
- containerPort: 8080
env:
- name: PASSWORD
value: "123456"
volumeMounts:
- name: coder-data
mountPath: /home/coder/project
volumes:
- name: coder-data
persistentVolumeClaim:
claimName: code-server