k8s中部署goland

官方仓库提供全家桶的官方镜像
现在只需要在服务器申请2C4G左右的资源就可以在网页上运行goland进行开发(只支持一个用户)
并且支持在线安装插件(有网络的情况)

部署

kubernetes

使用的local存储并且固定调度在local存储的节点上

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
## deploy
kind: Deployment
apiVersion: apps/v1
metadata:
name: goland-web
namespace: tool
labels:
app: goland-web
spec:
replicas: 1
selector:
matchLabels:
app: goland-web
template:
metadata:
labels:
app: goland-web
spec:
volumes:
- name: volume-5k7qtr
persistentVolumeClaim:
claimName: goland-web-pvc
- name: localtime
hostPath:
path: /etc/localtime
containers:
- name: container-8bizjn
image: '10.221.1.41/library/projector-goland:20210325'
resources:
limits:
cpu: '2'
memory: 4000Mi
requests:
cpu: 10m
memory: 10Mi
volumeMounts:
- name: volume-5k7qtr
mountPath: /home/projector-user
- name: localtime
mountPath: /etc/localtime
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
nodeSelector:
kubernetes.io/hostname: node2
serviceAccountName: default
serviceAccount: default
securityContext: {}
imagePullSecrets:
- name: local-harbor
affinity: {}
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600

## pvc
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: goland-web-pvc
namespace: tool
labels:
app: goland-web-pvc
finalizers:
- kubernetes.io/pvc-protection
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
volumeName: pvc-124fa1cd-0403-43a9-a476-aca59fe59af8
storageClassName: local
volumeMode: Filesystem

## svc
kind: Service
apiVersion: v1
metadata:
name: goland-web-svc
namespace: tool
labels:
app: goland-web-svc
spec:
ports:
- name: tcp-80
protocol: TCP
port: 80
targetPort: 8887
nodePort: 31284
selector:
app: goland-web
clusterIP: 10.233.19.145
type: NodePort
sessionAffinity: ClientIP
externalTrafficPolicy: Cluster

配置

使用主机IP+31284 直接访问goland
官方镜像是不自带GO SDK的,所以我们自己提前下载好并且推送到goland-web的持久化目录/home/projector-user/中
同样配置文件settings.zip也可以通过这种方式导入
其他配置就和本地goland一样直接配置就行

问题

界面展示很小 只占用屏幕的小部分

其实是可以拖动右下角来控制界面大小的