kubernetes-yaml/examples/drawio/drawio.yaml

193 lines
4.8 KiB
YAML
Raw Normal View History

2023-12-15 16:39:01 +08:00
---
# 创建 Namespace
apiVersion: v1
kind: Namespace
metadata:
name: hty1024-app
---
# 创建 StorageClass
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: storage-local-drawio
labels:
app.k8s.hty1024.com/env: prod
app.k8s.hty1024.com/type: app
app.k8s.hty1024.com/name: drawio
2024-10-11 01:03:00 +08:00
app.k8s.hty1024.com/version: 24.7.17
2023-12-15 16:39:01 +08:00
app.k8s.hty1024.com/resources: storageClass
provisioner: kubernetes.io/no-provisioner
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer
---
# 创建 PersistentVolume
apiVersion: v1
kind: PersistentVolume
metadata:
name: hty1024-app-drawio-pv
labels:
app.k8s.hty1024.com/env: prod
app.k8s.hty1024.com/type: app
app.k8s.hty1024.com/name: drawio
2024-10-11 01:03:00 +08:00
app.k8s.hty1024.com/version: 24.7.17
2023-12-15 16:39:01 +08:00
app.k8s.hty1024.com/resources: persistentVolume
spec:
capacity:
storage: 1Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: storage-local-drawio
local:
path: /app/drawio/fonts
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: node.k8s.hty1024.com/type
operator: In
values:
- app
---
# 创建 PersistentVolumeClaim
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: hty1024-app-drawio-pvc
namespace: hty1024-app
labels:
app.k8s.hty1024.com/env: prod
app.k8s.hty1024.com/type: app
app.k8s.hty1024.com/name: drawio
2024-10-11 01:03:00 +08:00
app.k8s.hty1024.com/version: 24.7.17
2023-12-15 16:39:01 +08:00
app.k8s.hty1024.com/resources: persistentVolumeClaim
spec:
resources:
requests:
storage: 1Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
storageClassName: storage-local-drawio
---
# 创建 Service
apiVersion: v1
kind: Service
metadata:
name: hty1024-app-drawio-service
namespace: hty1024-app
labels:
app.k8s.hty1024.com/env: prod
app.k8s.hty1024.com/type: app
app.k8s.hty1024.com/name: drawio
2024-10-11 01:03:00 +08:00
app.k8s.hty1024.com/version: 24.7.17
2023-12-15 16:39:01 +08:00
app.k8s.hty1024.com/resources: service
spec:
type: NodePort
ports:
- port: 8080
targetPort: 8080
nodePort: 30000
selector:
app.k8s.hty1024.com/env: prod
app.k8s.hty1024.com/type: app
app.k8s.hty1024.com/name: drawio
2024-10-11 01:03:00 +08:00
app.k8s.hty1024.com/version: 24.7.17
2023-12-15 16:39:01 +08:00
app.k8s.hty1024.com/resources: pod
---
# 创建 Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: hty1024-app-drawio-deployment
namespace: hty1024-app
labels:
app.k8s.hty1024.com/env: prod
app.k8s.hty1024.com/type: app
app.k8s.hty1024.com/name: drawio
2024-10-11 01:03:00 +08:00
app.k8s.hty1024.com/version: 24.7.17
2023-12-15 16:39:01 +08:00
app.k8s.hty1024.com/resources: deployment
spec:
replicas: 1
minReadySeconds: 30
selector:
matchLabels:
app.k8s.hty1024.com/env: prod
app.k8s.hty1024.com/type: app
app.k8s.hty1024.com/name: drawio
2024-10-11 01:03:00 +08:00
app.k8s.hty1024.com/version: 24.7.17
2023-12-15 16:39:01 +08:00
app.k8s.hty1024.com/resources: pod
template:
metadata:
labels:
app.k8s.hty1024.com/env: prod
app.k8s.hty1024.com/type: app
app.k8s.hty1024.com/name: drawio
2024-10-11 01:03:00 +08:00
app.k8s.hty1024.com/version: 24.7.17
2023-12-15 16:39:01 +08:00
app.k8s.hty1024.com/resources: pod
spec:
terminationGracePeriodSeconds: 60
volumes:
- name: localtime
hostPath:
path: /etc/localtime
- name: hty1024-app-drawio-data
persistentVolumeClaim:
claimName: hty1024-app-drawio-pvc
containers:
# - name: plantuml-server
2024-10-11 01:03:00 +08:00
# image: plantuml/plantuml-server:v1.2024.7
2023-12-15 16:39:01 +08:00
# volumeMounts:
# - name: localtime
# mountPath: /etc/localtime
# readOnly: true
# - name: hty1024-app-drawio-data
# mountPath: /usr/share/fonts/drawio
- name: export-server
image: jgraph/export-server:latest
volumeMounts:
- name: localtime
mountPath: /etc/localtime
readOnly: true
- name: hty1024-app-drawio-data
mountPath: /usr/share/fonts/drawio
ports:
- name: tcp
containerPort: 8000
env:
- name: DRAWIO_SERVER_URL
value: "http://localhost:8080"
- name: drawio
2024-10-11 01:03:00 +08:00
image: jgraph/drawio:24.7.17
2023-12-15 16:39:01 +08:00
volumeMounts:
- name: localtime
mountPath: /etc/localtime
readOnly: true
ports:
- name: tcp
containerPort: 8080
env:
- name: DRAWIO_SELF_CONTAINED
value: "1"
- name: DRAWIO_BASE_URL
value: "http://localhost:8080"
# - name: PLANTUML_URL
# value: "http://plantuml-server:8080"
- name: EXPORT_URL
value: "http://localhost:8000"
nodeSelector:
node.k8s.hty1024.com/type: app