K8s yaml (#254)
* wjluo add k8s-yaml, 20220509 * Update README.md Co-authored-by: ccoe <ccoe@wjluodeMacBook-Pro.local>
This commit is contained in:
parent
5695d6b2e2
commit
bb65396df6
35
playground/deploy-k8s/README.md
Normal file
35
playground/deploy-k8s/README.md
Normal file
@ -0,0 +1,35 @@
|
||||
# K8S部署指南
|
||||
|
||||
## 环境准备
|
||||
|
||||
1、准备一个标准的Kubernetes集群。
|
||||
2、创建一个storageClassName,譬如 cbs-next-terminal
|
||||
3、创建一个命名空间 next-terminal
|
||||
|
||||
## 启动next-terminal
|
||||
1、根据需要修改相关参数,譬如PV卷的大小,端口。
|
||||
2、执行start.sh,如下所示:
|
||||
- kubectl apply -f mysql-claim0-persistentvolumeclaim.yaml -n next-terminal
|
||||
- kubectl apply -f mysql-deployment.yaml -n next-terminal
|
||||
- kubectl apply -f mysql-service.yaml -n next-terminal
|
||||
- kubectl apply -f guacd-claim0-persistentvolumeclaim.yaml -n next-terminal
|
||||
- kubectl apply -f guacd-deployment.yaml -n next-terminal
|
||||
- kubectl apply -f guacd-service.yaml -n next-terminal
|
||||
- kubectl apply -f next-terminal-claim0-persistentvolumeclaim.yaml -n next-terminal
|
||||
- kubectl apply -f next-terminal-claim1-persistentvolumeclaim.yaml -n next-terminal
|
||||
- kubectl apply -f next-terminal-deployment.yaml -n next-terminal
|
||||
- kubectl apply -f next-terminal-service.yaml -n next-terminal
|
||||
3、在Kubernetes集群中查询service,可以增加ingress配置,进行访问。
|
||||
|
||||
## 销毁next-terminal
|
||||
1、执行stop.sh,如下所示:
|
||||
- kubectl delete -f mysql-service.yaml -n next-terminal
|
||||
- kubectl delete -f mysql-deployment.yaml -n next-terminal
|
||||
- kubectl delete -f mysql-claim0-persistentvolumeclaim.yaml -n next-terminal
|
||||
- kubectl delete -f guacd-service.yaml -n next-terminal
|
||||
- kubectl delete -f guacd-deployment.yaml -n next-terminal
|
||||
- kubectl delete -f guacd-claim0-persistentvolumeclaim.yaml -n next-terminal
|
||||
- kubectl delete -f next-terminal-service.yaml -n next-terminal
|
||||
- kubectl delete -f next-terminal-deployment.yaml -n next-terminal
|
||||
- kubectl delete -f next-terminal-claim0-persistentvolumeclaim.yaml -n next-terminal
|
||||
- kubectl delete -f next-terminal-claim1-persistentvolumeclaim.yaml -n next-terminal
|
@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: guacd-claim0
|
||||
name: guacd-claim0
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
storageClassName: cbs-next-terminal
|
||||
status: {}
|
39
playground/deploy-k8s/guacd-deployment.yaml
Normal file
39
playground/deploy-k8s/guacd-deployment.yaml
Normal file
@ -0,0 +1,39 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert
|
||||
kompose.version: 1.26.1 (a9d05d509)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: guacd
|
||||
name: guacd
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
io.kompose.service: guacd
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert
|
||||
kompose.version: 1.26.1 (a9d05d509)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: guacd
|
||||
spec:
|
||||
containers:
|
||||
- image: dushixiang/guacd:latest
|
||||
name: guacd
|
||||
resources: {}
|
||||
volumeMounts:
|
||||
- mountPath: /usr/local/next-terminal/data
|
||||
name: guacd-claim0
|
||||
restartPolicy: Always
|
||||
volumes:
|
||||
- name: guacd-claim0
|
||||
persistentVolumeClaim:
|
||||
claimName: guacd-claim0
|
||||
status: {}
|
19
playground/deploy-k8s/guacd-service.yaml
Normal file
19
playground/deploy-k8s/guacd-service.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert
|
||||
kompose.version: 1.26.1 (a9d05d509)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: guacd
|
||||
name: guacd
|
||||
spec:
|
||||
ports:
|
||||
- name: "4822"
|
||||
port: 4822
|
||||
targetPort: 4822
|
||||
selector:
|
||||
io.kompose.service: guacd
|
||||
status:
|
||||
loadBalancer: {}
|
@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: mysql-claim0
|
||||
name: mysql-claim0
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
storageClassName: cbs-next-terminal
|
||||
status: {}
|
48
playground/deploy-k8s/mysql-deployment.yaml
Normal file
48
playground/deploy-k8s/mysql-deployment.yaml
Normal file
@ -0,0 +1,48 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert
|
||||
kompose.version: 1.26.1 (a9d05d509)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: mysql
|
||||
name: mysql
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
io.kompose.service: mysql
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert
|
||||
kompose.version: 1.26.1 (a9d05d509)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: mysql
|
||||
spec:
|
||||
containers:
|
||||
- env:
|
||||
- name: MYSQL_DATABASE
|
||||
value: next-terminal
|
||||
- name: MYSQL_PASSWORD
|
||||
value: next-terminal
|
||||
- name: MYSQL_ROOT_PASSWORD
|
||||
value: next-terminal
|
||||
- name: MYSQL_USER
|
||||
value: next-terminal
|
||||
image: mysql:8.0
|
||||
name: mysql
|
||||
resources: {}
|
||||
volumeMounts:
|
||||
- mountPath: /var/lib/mysql
|
||||
name: mysql-claim0
|
||||
restartPolicy: Always
|
||||
volumes:
|
||||
- name: mysql-claim0
|
||||
persistentVolumeClaim:
|
||||
claimName: mysql-claim0
|
||||
status: {}
|
19
playground/deploy-k8s/mysql-service.yaml
Normal file
19
playground/deploy-k8s/mysql-service.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert
|
||||
kompose.version: 1.26.1 (a9d05d509)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: mysql
|
||||
name: mysql
|
||||
spec:
|
||||
ports:
|
||||
- name: "3306"
|
||||
port: 3306
|
||||
targetPort: 3306
|
||||
selector:
|
||||
io.kompose.service: mysql
|
||||
status:
|
||||
loadBalancer: {}
|
@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: next-terminal-claim0
|
||||
name: next-terminal-claim0
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
storageClassName: cbs-next-terminal
|
||||
status: {}
|
@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: next-terminal-claim1
|
||||
name: next-terminal-claim1
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
storageClassName: cbs-next-terminal
|
||||
status: {}
|
63
playground/deploy-k8s/next-terminal-deployment.yaml
Normal file
63
playground/deploy-k8s/next-terminal-deployment.yaml
Normal file
@ -0,0 +1,63 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert
|
||||
kompose.version: 1.26.1 (a9d05d509)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: next-terminal
|
||||
name: next-terminal
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
io.kompose.service: next-terminal
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert
|
||||
kompose.version: 1.26.1 (a9d05d509)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: next-terminal
|
||||
spec:
|
||||
containers:
|
||||
- env:
|
||||
- name: DB
|
||||
value: mysql
|
||||
- name: GUACD_HOSTNAME
|
||||
value: guacd
|
||||
- name: GUACD_PORT
|
||||
value: "4822"
|
||||
- name: MYSQL_DATABASE
|
||||
value: next-terminal
|
||||
- name: MYSQL_HOSTNAME
|
||||
value: mysql
|
||||
- name: MYSQL_PASSWORD
|
||||
value: next-terminal
|
||||
- name: MYSQL_PORT
|
||||
value: "3306"
|
||||
- name: MYSQL_USERNAME
|
||||
value: next-terminal
|
||||
image: dushixiang/next-terminal:latest
|
||||
name: next-terminal
|
||||
ports:
|
||||
- containerPort: 8088
|
||||
resources: {}
|
||||
volumeMounts:
|
||||
- mountPath: /etc
|
||||
name: next-terminal-claim0
|
||||
- mountPath: /usr/local/next-terminal/data
|
||||
name: next-terminal-claim1
|
||||
restartPolicy: Always
|
||||
volumes:
|
||||
- name: next-terminal-claim0
|
||||
persistentVolumeClaim:
|
||||
claimName: next-terminal-claim0
|
||||
- name: next-terminal-claim1
|
||||
persistentVolumeClaim:
|
||||
claimName: next-terminal-claim1
|
||||
status: {}
|
19
playground/deploy-k8s/next-terminal-service.yaml
Normal file
19
playground/deploy-k8s/next-terminal-service.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert
|
||||
kompose.version: 1.26.1 (a9d05d509)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: next-terminal
|
||||
name: next-terminal
|
||||
spec:
|
||||
ports:
|
||||
- name: "8088"
|
||||
port: 8088
|
||||
targetPort: 8088
|
||||
selector:
|
||||
io.kompose.service: next-terminal
|
||||
status:
|
||||
loadBalancer: {}
|
10
playground/deploy-k8s/start.sh
Normal file
10
playground/deploy-k8s/start.sh
Normal file
@ -0,0 +1,10 @@
|
||||
kubectl apply -f mysql-claim0-persistentvolumeclaim.yaml -n next-terminal
|
||||
kubectl apply -f mysql-deployment.yaml -n next-terminal
|
||||
kubectl apply -f mysql-service.yaml -n next-terminal
|
||||
kubectl apply -f guacd-claim0-persistentvolumeclaim.yaml -n next-terminal
|
||||
kubectl apply -f guacd-deployment.yaml -n next-terminal
|
||||
kubectl apply -f guacd-service.yaml -n next-terminal
|
||||
kubectl apply -f next-terminal-claim0-persistentvolumeclaim.yaml -n next-terminal
|
||||
kubectl apply -f next-terminal-claim1-persistentvolumeclaim.yaml -n next-terminal
|
||||
kubectl apply -f next-terminal-deployment.yaml -n next-terminal
|
||||
kubectl apply -f next-terminal-service.yaml -n next-terminal
|
11
playground/deploy-k8s/stop.sh
Normal file
11
playground/deploy-k8s/stop.sh
Normal file
@ -0,0 +1,11 @@
|
||||
kubectl delete -f mysql-service.yaml -n next-terminal
|
||||
kubectl delete -f mysql-deployment.yaml -n next-terminal
|
||||
kubectl delete -f mysql-claim0-persistentvolumeclaim.yaml -n next-terminal
|
||||
kubectl delete -f guacd-service.yaml -n next-terminal
|
||||
kubectl delete -f guacd-deployment.yaml -n next-terminal
|
||||
kubectl delete -f guacd-claim0-persistentvolumeclaim.yaml -n next-terminal
|
||||
kubectl delete -f next-terminal-service.yaml -n next-terminal
|
||||
kubectl delete -f next-terminal-deployment.yaml -n next-terminal
|
||||
kubectl delete -f next-terminal-claim0-persistentvolumeclaim.yaml -n next-terminal
|
||||
kubectl delete -f next-terminal-claim1-persistentvolumeclaim.yaml -n next-terminal
|
||||
|
Loading…
Reference in New Issue
Block a user