* wjluo add k8s-yaml, 20220509

* Update README.md

Co-authored-by: ccoe <ccoe@wjluodeMacBook-Pro.local>
This commit is contained in:
wjluo 2022-05-08 14:20:59 +08:00 committed by GitHub
parent 5695d6b2e2
commit bb65396df6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 323 additions and 0 deletions

View 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

View File

@ -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: {}

View 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: {}

View 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: {}

View File

@ -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: {}

View 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: {}

View 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: {}

View File

@ -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: {}

View File

@ -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: {}

View 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: {}

View 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: {}

View 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

View 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