新增说明及示例文件
This commit is contained in:
12
examples/dashboard/dashboard.admin-user-role.yml
Normal file
12
examples/dashboard/dashboard.admin-user-role.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: admin-user
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: cluster-admin
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: admin-user
|
||||
namespace: kubernetes-dashboard
|
||||
5
examples/dashboard/dashboard.admin-user.yml
Normal file
5
examples/dashboard/dashboard.admin-user.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: admin-user
|
||||
namespace: kubernetes-dashboard
|
||||
308
examples/dashboard/dashboard.yaml
Normal file
308
examples/dashboard/dashboard.yaml
Normal file
@@ -0,0 +1,308 @@
|
||||
# Copyright 2017 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: kubernetes-dashboard
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kubernetes-dashboard
|
||||
name: kubernetes-dashboard
|
||||
namespace: kubernetes-dashboard
|
||||
|
||||
---
|
||||
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kubernetes-dashboard
|
||||
name: kubernetes-dashboard
|
||||
namespace: kubernetes-dashboard
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- port: 443
|
||||
targetPort: 8443
|
||||
nodePort: 30000
|
||||
selector:
|
||||
k8s-app: kubernetes-dashboard
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kubernetes-dashboard
|
||||
name: kubernetes-dashboard-certs
|
||||
namespace: kubernetes-dashboard
|
||||
type: Opaque
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kubernetes-dashboard
|
||||
name: kubernetes-dashboard-csrf
|
||||
namespace: kubernetes-dashboard
|
||||
type: Opaque
|
||||
data:
|
||||
csrf: ""
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kubernetes-dashboard
|
||||
name: kubernetes-dashboard-key-holder
|
||||
namespace: kubernetes-dashboard
|
||||
type: Opaque
|
||||
|
||||
---
|
||||
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kubernetes-dashboard
|
||||
name: kubernetes-dashboard-settings
|
||||
namespace: kubernetes-dashboard
|
||||
|
||||
---
|
||||
|
||||
kind: Role
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kubernetes-dashboard
|
||||
name: kubernetes-dashboard
|
||||
namespace: kubernetes-dashboard
|
||||
rules:
|
||||
# Allow Dashboard to get, update and delete Dashboard exclusive secrets.
|
||||
- apiGroups: [""]
|
||||
resources: ["secrets"]
|
||||
resourceNames: ["kubernetes-dashboard-key-holder", "kubernetes-dashboard-certs", "kubernetes-dashboard-csrf"]
|
||||
verbs: ["get", "update", "delete"]
|
||||
# Allow Dashboard to get and update 'kubernetes-dashboard-settings' config map.
|
||||
- apiGroups: [""]
|
||||
resources: ["configmaps"]
|
||||
resourceNames: ["kubernetes-dashboard-settings"]
|
||||
verbs: ["get", "update"]
|
||||
# Allow Dashboard to get metrics.
|
||||
- apiGroups: [""]
|
||||
resources: ["services"]
|
||||
resourceNames: ["heapster", "dashboard-metrics-scraper"]
|
||||
verbs: ["proxy"]
|
||||
- apiGroups: [""]
|
||||
resources: ["services/proxy"]
|
||||
resourceNames: ["heapster", "http:heapster:", "https:heapster:", "dashboard-metrics-scraper", "http:dashboard-metrics-scraper"]
|
||||
verbs: ["get"]
|
||||
|
||||
---
|
||||
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kubernetes-dashboard
|
||||
name: kubernetes-dashboard
|
||||
rules:
|
||||
# Allow Metrics Scraper to get metrics from the Metrics server
|
||||
- apiGroups: ["metrics.k8s.io"]
|
||||
resources: ["pods", "nodes"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
|
||||
---
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kubernetes-dashboard
|
||||
name: kubernetes-dashboard
|
||||
namespace: kubernetes-dashboard
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: kubernetes-dashboard
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: kubernetes-dashboard
|
||||
namespace: kubernetes-dashboard
|
||||
|
||||
---
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: kubernetes-dashboard
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: kubernetes-dashboard
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: kubernetes-dashboard
|
||||
namespace: kubernetes-dashboard
|
||||
|
||||
---
|
||||
|
||||
kind: Deployment
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kubernetes-dashboard
|
||||
name: kubernetes-dashboard
|
||||
namespace: kubernetes-dashboard
|
||||
spec:
|
||||
replicas: 1
|
||||
revisionHistoryLimit: 10
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: kubernetes-dashboard
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kubernetes-dashboard
|
||||
spec:
|
||||
securityContext:
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
containers:
|
||||
- name: kubernetes-dashboard
|
||||
image: kubernetesui/dashboard:v2.7.0
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8443
|
||||
protocol: TCP
|
||||
args:
|
||||
- --auto-generate-certificates
|
||||
- --namespace=kubernetes-dashboard
|
||||
# Uncomment the following line to manually specify Kubernetes API server Host
|
||||
# If not specified, Dashboard will attempt to auto discover the API server and connect
|
||||
# to it. Uncomment only if the default does not work.
|
||||
# - --apiserver-host=http://my-address:port
|
||||
volumeMounts:
|
||||
- name: kubernetes-dashboard-certs
|
||||
mountPath: /certs
|
||||
# Create on-disk volume to store exec logs
|
||||
- mountPath: /tmp
|
||||
name: tmp-volume
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
scheme: HTTPS
|
||||
path: /
|
||||
port: 8443
|
||||
initialDelaySeconds: 30
|
||||
timeoutSeconds: 30
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsUser: 1001
|
||||
runAsGroup: 2001
|
||||
volumes:
|
||||
- name: kubernetes-dashboard-certs
|
||||
secret:
|
||||
secretName: kubernetes-dashboard-certs
|
||||
- name: tmp-volume
|
||||
emptyDir: {}
|
||||
serviceAccountName: kubernetes-dashboard
|
||||
nodeSelector:
|
||||
"kubernetes.io/os": linux
|
||||
# Comment the following tolerations if Dashboard must not be deployed on master
|
||||
tolerations:
|
||||
- key: node-role.kubernetes.io/master
|
||||
effect: NoSchedule
|
||||
|
||||
---
|
||||
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: dashboard-metrics-scraper
|
||||
name: dashboard-metrics-scraper
|
||||
namespace: kubernetes-dashboard
|
||||
spec:
|
||||
ports:
|
||||
- port: 8000
|
||||
targetPort: 8000
|
||||
selector:
|
||||
k8s-app: dashboard-metrics-scraper
|
||||
|
||||
---
|
||||
|
||||
kind: Deployment
|
||||
apiVersion: apps/v1
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: dashboard-metrics-scraper
|
||||
name: dashboard-metrics-scraper
|
||||
namespace: kubernetes-dashboard
|
||||
spec:
|
||||
replicas: 1
|
||||
revisionHistoryLimit: 10
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: dashboard-metrics-scraper
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: dashboard-metrics-scraper
|
||||
spec:
|
||||
securityContext:
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
containers:
|
||||
- name: dashboard-metrics-scraper
|
||||
image: kubernetesui/metrics-scraper:v1.0.8
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
scheme: HTTP
|
||||
path: /
|
||||
port: 8000
|
||||
initialDelaySeconds: 30
|
||||
timeoutSeconds: 30
|
||||
volumeMounts:
|
||||
- mountPath: /tmp
|
||||
name: tmp-volume
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsUser: 1001
|
||||
runAsGroup: 2001
|
||||
serviceAccountName: kubernetes-dashboard
|
||||
nodeSelector:
|
||||
"kubernetes.io/os": linux
|
||||
# Comment the following tolerations if Dashboard must not be deployed on master
|
||||
tolerations:
|
||||
- key: node-role.kubernetes.io/master
|
||||
effect: NoSchedule
|
||||
volumes:
|
||||
- name: tmp-volume
|
||||
emptyDir: {}
|
||||
192
examples/drawio/drawio.yaml
Normal file
192
examples/drawio/drawio.yaml
Normal file
@@ -0,0 +1,192 @@
|
||||
---
|
||||
|
||||
# 创建 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
|
||||
app.k8s.hty1024.com/version: 22.1.8
|
||||
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
|
||||
app.k8s.hty1024.com/version: 22.1.8
|
||||
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
|
||||
app.k8s.hty1024.com/version: 22.1.8
|
||||
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
|
||||
app.k8s.hty1024.com/version: 22.1.8
|
||||
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
|
||||
app.k8s.hty1024.com/version: 22.1.8
|
||||
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
|
||||
app.k8s.hty1024.com/version: 22.1.8
|
||||
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
|
||||
app.k8s.hty1024.com/version: 22.1.8
|
||||
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
|
||||
app.k8s.hty1024.com/version: 22.1.8
|
||||
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
|
||||
# image: plantuml/plantuml-server:v1.2023.13
|
||||
# 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
|
||||
image: jgraph/drawio:22.1.8
|
||||
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
|
||||
|
||||
163
examples/gitea/gitea.yaml
Normal file
163
examples/gitea/gitea.yaml
Normal file
@@ -0,0 +1,163 @@
|
||||
---
|
||||
|
||||
# 创建 Namespace
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: hty1024-app
|
||||
|
||||
---
|
||||
|
||||
# 创建 StorageClass
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: storage-local-gitea
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: gitea
|
||||
app.k8s.hty1024.com/version: 1.19.4
|
||||
app.k8s.hty1024.com/resources: storageClass
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
reclaimPolicy: Retain
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
|
||||
---
|
||||
|
||||
# 创建 PersistentVolume
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: hty1024-app-gitea-pv
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: gitea
|
||||
app.k8s.hty1024.com/version: 1.19.4
|
||||
app.k8s.hty1024.com/resources: persistentVolume
|
||||
spec:
|
||||
capacity:
|
||||
storage: 20Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: storage-local-gitea
|
||||
local:
|
||||
path: /app/gitea/data
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: node.k8s.hty1024.com/type
|
||||
operator: In
|
||||
values:
|
||||
- app
|
||||
|
||||
---
|
||||
|
||||
# 创建 PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: hty1024-app-gitea-pvc
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: gitea
|
||||
app.k8s.hty1024.com/version: 1.19.4
|
||||
app.k8s.hty1024.com/resources: persistentVolumeClaim
|
||||
spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: 20Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: storage-local-gitea
|
||||
|
||||
---
|
||||
|
||||
# 创建 Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hty1024-app-gitea-service
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: gitea
|
||||
app.k8s.hty1024.com/version: 1.19.4
|
||||
app.k8s.hty1024.com/resources: service
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- port: 3000
|
||||
targetPort: 3000
|
||||
nodePort: 30000
|
||||
selector:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: gitea
|
||||
app.k8s.hty1024.com/version: 1.19.4
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
|
||||
---
|
||||
|
||||
# 创建 StatefulSet
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: hty1024-app-gitea-statefulset
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: gitea
|
||||
app.k8s.hty1024.com/version: 1.19.4
|
||||
app.k8s.hty1024.com/resources: statefulSet
|
||||
spec:
|
||||
replicas: 1
|
||||
minReadySeconds: 30
|
||||
selector:
|
||||
matchLabels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: gitea
|
||||
app.k8s.hty1024.com/version: 1.19.4
|
||||
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: gitea
|
||||
app.k8s.hty1024.com/version: 1.19.4
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 60
|
||||
volumes:
|
||||
- name: localtime
|
||||
hostPath:
|
||||
path: /etc/localtime
|
||||
- name: hty1024-app-gitea-data
|
||||
persistentVolumeClaim:
|
||||
claimName: hty1024-app-gitea-pvc
|
||||
containers:
|
||||
- name: gitea
|
||||
image: gitea/gitea:1.19.4
|
||||
ports:
|
||||
- name: tcp
|
||||
containerPort: 3000
|
||||
volumeMounts:
|
||||
- name: localtime
|
||||
mountPath: /etc/localtime
|
||||
readOnly: true
|
||||
- name: hty1024-app-gitea-data
|
||||
mountPath: /data
|
||||
nodeSelector:
|
||||
node.k8s.hty1024.com/type: app
|
||||
|
||||
178
examples/halo/halo.yaml
Normal file
178
examples/halo/halo.yaml
Normal file
@@ -0,0 +1,178 @@
|
||||
---
|
||||
|
||||
# 创建 Namespace
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: hty1024-app
|
||||
|
||||
---
|
||||
|
||||
# 创建 StorageClass
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: storage-local-halo
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: halo
|
||||
app.k8s.hty1024.com/version: 1.6.1
|
||||
app.k8s.hty1024.com/resources: storageClass
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
reclaimPolicy: Retain
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
|
||||
---
|
||||
|
||||
# 创建 PersistentVolume
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: hty1024-app-halo-pv
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: halo
|
||||
app.k8s.hty1024.com/version: 1.6.1
|
||||
app.k8s.hty1024.com/resources: persistentVolume
|
||||
spec:
|
||||
capacity:
|
||||
storage: 10Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: storage-local-halo
|
||||
local:
|
||||
path: /app/halo/data
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: node.k8s.hty1024.com/type
|
||||
operator: In
|
||||
values:
|
||||
- app
|
||||
|
||||
---
|
||||
|
||||
# 创建 PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: hty1024-app-halo-pvc
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: halo
|
||||
app.k8s.hty1024.com/version: 1.6.1
|
||||
app.k8s.hty1024.com/resources: persistentVolumeClaim
|
||||
spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: storage-local-halo
|
||||
|
||||
---
|
||||
|
||||
# 创建 Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hty1024-app-halo-service
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: halo
|
||||
app.k8s.hty1024.com/version: 1.6.1
|
||||
app.k8s.hty1024.com/resources: service
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- port: 8090
|
||||
targetPort: 8090
|
||||
nodePort: 30000
|
||||
selector:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: halo
|
||||
app.k8s.hty1024.com/version: 1.6.1
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
|
||||
---
|
||||
|
||||
# 创建 StatefulSet
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: hty1024-app-halo-statefulset
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: halo
|
||||
app.k8s.hty1024.com/version: 1.6.1
|
||||
app.k8s.hty1024.com/resources: statefulSet
|
||||
spec:
|
||||
replicas: 1
|
||||
minReadySeconds: 30
|
||||
selector:
|
||||
matchLabels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: halo
|
||||
app.k8s.hty1024.com/version: 1.6.1
|
||||
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: halo
|
||||
app.k8s.hty1024.com/version: 1.6.1
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 60
|
||||
volumes:
|
||||
- name: localtime
|
||||
hostPath:
|
||||
path: /etc/localtime
|
||||
- name: hty1024-app-halo-data
|
||||
persistentVolumeClaim:
|
||||
claimName: hty1024-app-halo-pvc
|
||||
containers:
|
||||
- name: halo
|
||||
image: halohub/halo:1.6.1
|
||||
ports:
|
||||
- name: tcp
|
||||
containerPort: 8090
|
||||
volumeMounts:
|
||||
- name: localtime
|
||||
mountPath: /etc/localtime
|
||||
readOnly: true
|
||||
- name: hty1024-app-halo-data
|
||||
mountPath: /root/.halo
|
||||
env:
|
||||
- name: SERVER_PORT
|
||||
value: "8090"
|
||||
- name: SPRING_DATASOURCE_DRIVER_CLASS_NAME
|
||||
value: "com.mysql.cj.jdbc.Driver"
|
||||
- name: SPRING_DATASOURCE_URL
|
||||
value: "jdbc:mysql://hty1024-db-mysql-service.hty1024-db:3306/halo?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true"
|
||||
- name: SPRING_DATASOURCE_USERNAME
|
||||
value: "halo"
|
||||
- name: SPRING_DATASOURCE_PASSWORD
|
||||
value: "123456"
|
||||
- name: HALO_ADMIN_PATH
|
||||
value: "admin"
|
||||
- name: HALO_CACHE
|
||||
value: "memory"
|
||||
nodeSelector:
|
||||
node.k8s.hty1024.com/type: app
|
||||
|
||||
163
examples/kiwix-serve/kiwix-serve.yaml
Normal file
163
examples/kiwix-serve/kiwix-serve.yaml
Normal file
@@ -0,0 +1,163 @@
|
||||
---
|
||||
|
||||
# 创建 Namespace
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: hty1024-app
|
||||
|
||||
---
|
||||
|
||||
# 创建 StorageClass
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: storage-local-kiwix-serve
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: kiwix-serve
|
||||
app.k8s.hty1024.com/version: 3.6.0-alpine
|
||||
app.k8s.hty1024.com/resources: storageClass
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
reclaimPolicy: Retain
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
|
||||
---
|
||||
|
||||
# 创建 PersistentVolume
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: hty1024-app-kiwix-serve-pv
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: kiwix-serve
|
||||
app.k8s.hty1024.com/version: 3.6.0-alpine
|
||||
app.k8s.hty1024.com/resources: persistentVolume
|
||||
spec:
|
||||
capacity:
|
||||
storage: 100Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: storage-local-kiwix-serve
|
||||
local:
|
||||
path: /app/kiwix-serve/data
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: node.k8s.hty1024.com/type
|
||||
operator: In
|
||||
values:
|
||||
- app
|
||||
|
||||
---
|
||||
|
||||
# 创建 PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: hty1024-app-kiwix-serve-pvc
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: kiwix-serve
|
||||
app.k8s.hty1024.com/version: 3.6.0-alpine
|
||||
app.k8s.hty1024.com/resources: persistentVolumeClaim
|
||||
spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: 100Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: storage-local-kiwix-serve
|
||||
|
||||
---
|
||||
|
||||
# 创建 Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hty1024-app-kiwix-serve-service
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: kiwix-serve
|
||||
app.k8s.hty1024.com/version: 3.6.0-alpine
|
||||
app.k8s.hty1024.com/resources: service
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- port: 10080
|
||||
targetPort: 10080
|
||||
nodePort: 30000
|
||||
selector:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: kiwix-serve
|
||||
app.k8s.hty1024.com/version: 3.6.0-alpine
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
|
||||
---
|
||||
|
||||
# 创建 Deployment
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: hty1024-app-kiwix-serve-deployment
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: kiwix-serve
|
||||
app.k8s.hty1024.com/version: 3.6.0-alpine
|
||||
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: kiwix-serve
|
||||
app.k8s.hty1024.com/version: 3.6.0-alpine
|
||||
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: kiwix-serve
|
||||
app.k8s.hty1024.com/version: 3.6.0-alpine
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 60
|
||||
volumes:
|
||||
- name: localtime
|
||||
hostPath:
|
||||
path: /etc/localtime
|
||||
- name: hty1024-app-kiwix-serve-data
|
||||
persistentVolumeClaim:
|
||||
claimName: hty1024-app-kiwix-serve-pvc
|
||||
containers:
|
||||
- name: kiwix-serve
|
||||
image: hub.hty1024.com/hty1024/kiwix-serve:3.6.0-alpine
|
||||
ports:
|
||||
- name: tcp
|
||||
containerPort: 10080
|
||||
volumeMounts:
|
||||
- name: localtime
|
||||
mountPath: /etc/localtime
|
||||
readOnly: true
|
||||
- name: hty1024-app-kiwix-serve-data
|
||||
mountPath: /data
|
||||
nodeSelector:
|
||||
node.k8s.hty1024.com/type: app
|
||||
|
||||
220
examples/mysql/mysql-8-single.yaml
Normal file
220
examples/mysql/mysql-8-single.yaml
Normal file
@@ -0,0 +1,220 @@
|
||||
---
|
||||
|
||||
# 创建 Namespace
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: hty1024-db
|
||||
|
||||
---
|
||||
|
||||
# 创建 StorageClass
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: storage-local-mysql
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: mysql
|
||||
app.k8s.hty1024.com/version: 8.0.35
|
||||
app.k8s.hty1024.com/resources: storageClass
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
reclaimPolicy: Retain
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
|
||||
---
|
||||
|
||||
# 创建 PersistentVolume
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: hty1024-db-mysql-pv
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: mysql
|
||||
app.k8s.hty1024.com/version: 8.0.35
|
||||
app.k8s.hty1024.com/resources: persistentVolume
|
||||
spec:
|
||||
capacity:
|
||||
storage: 20Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: storage-local-mysql
|
||||
local:
|
||||
path: /app/mysql/data
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: node.k8s.hty1024.com/type
|
||||
operator: In
|
||||
values:
|
||||
- app
|
||||
|
||||
---
|
||||
|
||||
# 创建 PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: hty1024-db-mysql-pvc
|
||||
namespace: hty1024-db
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: mysql
|
||||
app.k8s.hty1024.com/version: 8.0.35
|
||||
app.k8s.hty1024.com/resources: persistentVolumeClaim
|
||||
spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: 20Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: storage-local-mysql
|
||||
|
||||
---
|
||||
|
||||
# 创建 ConfigMap(自定义 my.cnf 文件)
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: hty1024-db-mysql-cm
|
||||
namespace: hty1024-db
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: mysql
|
||||
app.k8s.hty1024.com/version: 8.0.35
|
||||
app.k8s.hty1024.com/resources: configMap
|
||||
data:
|
||||
my.cnf: |
|
||||
[mysqld]
|
||||
max_connections = 1000
|
||||
character-set-server = utf8mb4
|
||||
collation-server = utf8mb4_unicode_ci
|
||||
|
||||
---
|
||||
|
||||
# 创建 Secret(自定义 MySQL 用户密码)
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: hty1024-db-mysql-secret
|
||||
namespace: hty1024-db
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: mysql
|
||||
app.k8s.hty1024.com/version: 8.0.35
|
||||
app.k8s.hty1024.com/resources: secret
|
||||
type: Opaque
|
||||
stringData:
|
||||
root.key: |
|
||||
123456
|
||||
immutable: true
|
||||
|
||||
---
|
||||
|
||||
# 创建 Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hty1024-db-mysql-service
|
||||
namespace: hty1024-db
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: mysql
|
||||
app.k8s.hty1024.com/version: 8.0.35
|
||||
app.k8s.hty1024.com/resources: service
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: 3306
|
||||
targetPort: 3306
|
||||
selector:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: mysql
|
||||
app.k8s.hty1024.com/version: 8.0.35
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
|
||||
---
|
||||
|
||||
# 创建 StatefulSet
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: hty1024-db-mysql-statefulset
|
||||
namespace: hty1024-db
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: mysql
|
||||
app.k8s.hty1024.com/version: 8.0.35
|
||||
app.k8s.hty1024.com/resources: statefulSet
|
||||
spec:
|
||||
replicas: 1
|
||||
minReadySeconds: 30
|
||||
selector:
|
||||
matchLabels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: mysql
|
||||
app.k8s.hty1024.com/version: 8.0.35
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: mysql
|
||||
app.k8s.hty1024.com/version: 8.0.35
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 60
|
||||
volumes:
|
||||
- name: localtime
|
||||
hostPath:
|
||||
path: /etc/localtime
|
||||
- name: hty1024-db-mysql-data
|
||||
persistentVolumeClaim:
|
||||
claimName: hty1024-db-mysql-pvc
|
||||
- name: hty1024-db-mysql-conf
|
||||
configMap:
|
||||
name: hty1024-db-mysql-cm
|
||||
items:
|
||||
- key: my.cnf
|
||||
path: my.cnf
|
||||
- name: hty1024-db-mysql-pwd
|
||||
secret:
|
||||
secretName: hty1024-db-mysql-secret
|
||||
containers:
|
||||
- name: mysql
|
||||
image: mysql:8.0.35
|
||||
ports:
|
||||
- name: tcp
|
||||
containerPort: 3306
|
||||
volumeMounts:
|
||||
- name: localtime
|
||||
mountPath: /etc/localtime
|
||||
readOnly: true
|
||||
- name: hty1024-db-mysql-data
|
||||
mountPath: /var/lib/mysql
|
||||
- name: hty1024-db-mysql-conf
|
||||
mountPath: /etc/mysql/conf.d/
|
||||
- name: hty1024-db-mysql-pwd
|
||||
mountPath: /tmp/secret-volume
|
||||
readOnly: true
|
||||
env:
|
||||
- name: MYSQL_ROOT_PASSWORD_FILE
|
||||
value: "/tmp/secret-volume/root.key"
|
||||
nodeSelector:
|
||||
node.k8s.hty1024.com/type: app
|
||||
|
||||
91
examples/pgadmin4/pgadmin4.yaml
Normal file
91
examples/pgadmin4/pgadmin4.yaml
Normal file
@@ -0,0 +1,91 @@
|
||||
---
|
||||
|
||||
# 创建 Namespace
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: hty1024-db
|
||||
|
||||
---
|
||||
|
||||
# 创建 Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hty1024-db-pgadmin4-service
|
||||
namespace: hty1024-db
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: pgadmin4
|
||||
app.k8s.hty1024.com/version: 8.0.0
|
||||
app.k8s.hty1024.com/resources: service
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- name: pgadmin4
|
||||
port: 80
|
||||
targetPort: 80
|
||||
nodePort: 30000
|
||||
selector:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: pgadmin4
|
||||
app.k8s.hty1024.com/version: 8.0.0
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
|
||||
---
|
||||
|
||||
# 创建 Deployment
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: hty1024-db-pgadmin4
|
||||
namespace: hty1024-db
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: pgadmin4
|
||||
app.k8s.hty1024.com/version: 8.0.0
|
||||
app.k8s.hty1024.com/resources: deployment
|
||||
spec:
|
||||
replicas: 1
|
||||
minReadySeconds: 30
|
||||
selector:
|
||||
matchLabels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: pgadmin4
|
||||
app.k8s.hty1024.com/version: 8.0.0
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: pgadmin4
|
||||
app.k8s.hty1024.com/version: 8.0.0
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 60
|
||||
volumes:
|
||||
- name: localtime
|
||||
hostPath:
|
||||
path: /etc/localtime
|
||||
containers:
|
||||
- name: pgadmin4
|
||||
image: dpage/pgadmin4:8.0
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
volumeMounts:
|
||||
- name: localtime
|
||||
mountPath: /etc/localtime
|
||||
readOnly: true
|
||||
env:
|
||||
- name: PGADMIN_DEFAULT_EMAIL
|
||||
value: "test@hty1024.com"
|
||||
- name: PGADMIN_DEFAULT_PASSWORD
|
||||
value: "123456"
|
||||
nodeSelector:
|
||||
node.k8s.hty1024.com/type: app
|
||||
89
examples/phpmyadmin/phpmyadmin.yaml
Normal file
89
examples/phpmyadmin/phpmyadmin.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
---
|
||||
|
||||
# 创建 Namespace
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: hty1024-db
|
||||
|
||||
---
|
||||
|
||||
# 创建 Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hty1024-db-phpmyadmin-service
|
||||
namespace: hty1024-db
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: phpmyadmin
|
||||
app.k8s.hty1024.com/version: 5.2.1
|
||||
app.k8s.hty1024.com/resources: service
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- name: phpmyadmin
|
||||
port: 80
|
||||
targetPort: 80
|
||||
nodePort: 30000
|
||||
selector:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: phpmyadmin
|
||||
app.k8s.hty1024.com/version: 5.2.1
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
|
||||
---
|
||||
|
||||
# 创建 Deployment
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: hty1024-db-phpmyadmin
|
||||
namespace: hty1024-db
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: phpmyadmin
|
||||
app.k8s.hty1024.com/version: 5.2.1
|
||||
app.k8s.hty1024.com/resources: deployment
|
||||
spec:
|
||||
replicas: 1
|
||||
minReadySeconds: 30
|
||||
selector:
|
||||
matchLabels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: phpmyadmin
|
||||
app.k8s.hty1024.com/version: 5.2.1
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: phpmyadmin
|
||||
app.k8s.hty1024.com/version: 5.2.1
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 60
|
||||
volumes:
|
||||
- name: localtime
|
||||
hostPath:
|
||||
path: /etc/localtime
|
||||
containers:
|
||||
- name: phpmyadmin
|
||||
image: phpmyadmin:5.2.1
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
volumeMounts:
|
||||
- name: localtime
|
||||
mountPath: /etc/localtime
|
||||
readOnly: true
|
||||
env:
|
||||
- name: PMA_ARBITRARY
|
||||
value: "1"
|
||||
nodeSelector:
|
||||
node.k8s.hty1024.com/type: app
|
||||
191
examples/postgres/postgres-16-single.yaml
Normal file
191
examples/postgres/postgres-16-single.yaml
Normal file
@@ -0,0 +1,191 @@
|
||||
---
|
||||
|
||||
# 创建 Namespace
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: hty1024-db
|
||||
|
||||
---
|
||||
|
||||
# 创建 StorageClass
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: storage-local-postgres
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: postgres
|
||||
app.k8s.hty1024.com/version: 16.1-alpine3.19
|
||||
app.k8s.hty1024.com/resources: storageClass
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
reclaimPolicy: Retain
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
|
||||
---
|
||||
|
||||
# 创建 PersistentVolume
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: hty1024-db-postgres-pv
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: postgres
|
||||
app.k8s.hty1024.com/version: 16.1-alpine3.19
|
||||
app.k8s.hty1024.com/resources: persistentVolume
|
||||
spec:
|
||||
capacity:
|
||||
storage: 20Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: storage-local-postgres
|
||||
local:
|
||||
path: /app/postgres/data
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: node.k8s.hty1024.com/type
|
||||
operator: In
|
||||
values:
|
||||
- app
|
||||
|
||||
---
|
||||
|
||||
# 创建 PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: hty1024-db-postgres-pvc
|
||||
namespace: hty1024-db
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: postgres
|
||||
app.k8s.hty1024.com/version: 16.1-alpine3.19
|
||||
app.k8s.hty1024.com/resources: persistentVolumeClaim
|
||||
spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: 20Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: storage-local-postgres
|
||||
|
||||
---
|
||||
|
||||
# 创建 Secret(自定义 PostgreSQL 用户密码)
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: hty1024-db-postgres-secret
|
||||
namespace: hty1024-db
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: postgres
|
||||
app.k8s.hty1024.com/version: 16.1-alpine3.19
|
||||
app.k8s.hty1024.com/resources: secret
|
||||
type: Opaque
|
||||
stringData:
|
||||
postgres.key: |
|
||||
123456
|
||||
immutable: true
|
||||
|
||||
---
|
||||
|
||||
# 创建 Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hty1024-db-postgres-service
|
||||
namespace: hty1024-db
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: postgres
|
||||
app.k8s.hty1024.com/version: 16.1-alpine3.19
|
||||
app.k8s.hty1024.com/resources: service
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: 5432
|
||||
targetPort: 5432
|
||||
selector:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: postgres
|
||||
app.k8s.hty1024.com/version: 16.1-alpine3.19
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
|
||||
---
|
||||
|
||||
# 创建 StatefulSet
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: hty1024-db-postgres-statefulset
|
||||
namespace: hty1024-db
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: postgres
|
||||
app.k8s.hty1024.com/version: 16.1-alpine3.19
|
||||
app.k8s.hty1024.com/resources: statefulSet
|
||||
spec:
|
||||
replicas: 1
|
||||
minReadySeconds: 30
|
||||
selector:
|
||||
matchLabels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: postgres
|
||||
app.k8s.hty1024.com/version: 16.1-alpine3.19
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: db
|
||||
app.k8s.hty1024.com/name: postgres
|
||||
app.k8s.hty1024.com/version: 16.1-alpine3.19
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 60
|
||||
volumes:
|
||||
- name: localtime
|
||||
hostPath:
|
||||
path: /etc/localtime
|
||||
- name: hty1024-db-postgres-data
|
||||
persistentVolumeClaim:
|
||||
claimName: hty1024-db-postgres-pvc
|
||||
- name: hty1024-db-postgres-pwd
|
||||
secret:
|
||||
secretName: hty1024-db-postgres-secret
|
||||
containers:
|
||||
- name: postgres
|
||||
image: postgres:16.1-alpine3.19
|
||||
ports:
|
||||
- name: tcp
|
||||
containerPort: 5432
|
||||
volumeMounts:
|
||||
- name: localtime
|
||||
mountPath: /etc/localtime
|
||||
readOnly: true
|
||||
- name: hty1024-db-postgres-data
|
||||
mountPath: /var/lib/postgres
|
||||
- name: hty1024-db-postgres-pwd
|
||||
mountPath: /tmp/secret-volume
|
||||
readOnly: true
|
||||
env:
|
||||
- name: POSTGRES_PASSWORD_FILE
|
||||
value: "/tmp/secret-volume/postgres.key"
|
||||
nodeSelector:
|
||||
node.k8s.hty1024.com/type: app
|
||||
|
||||
166
examples/vaultwarden/vaultwarden.yaml
Normal file
166
examples/vaultwarden/vaultwarden.yaml
Normal file
@@ -0,0 +1,166 @@
|
||||
---
|
||||
|
||||
# 创建 Namespace
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: hty1024-app
|
||||
|
||||
---
|
||||
|
||||
# 创建 StorageClass
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: storage-local-vaultwarden
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: vaultwarden
|
||||
app.k8s.hty1024.com/version: 1.30.1-alpine
|
||||
app.k8s.hty1024.com/resources: storageClass
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
reclaimPolicy: Retain
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
|
||||
---
|
||||
|
||||
# 创建 PersistentVolume
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: hty1024-app-vaultwarden-pv
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: vaultwarden
|
||||
app.k8s.hty1024.com/version: 1.30.1-alpine
|
||||
app.k8s.hty1024.com/resources: persistentVolume
|
||||
spec:
|
||||
capacity:
|
||||
storage: 1Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: storage-local-vaultwarden
|
||||
local:
|
||||
path: /app/vaultwarden/data
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: node.k8s.hty1024.com/type
|
||||
operator: In
|
||||
values:
|
||||
- app
|
||||
|
||||
---
|
||||
|
||||
# 创建 PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: hty1024-app-vaultwarden-pvc
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: vaultwarden
|
||||
app.k8s.hty1024.com/version: 1.30.1-alpine
|
||||
app.k8s.hty1024.com/resources: persistentVolumeClaim
|
||||
spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: storage-local-vaultwarden
|
||||
|
||||
---
|
||||
|
||||
# 创建 Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hty1024-app-vaultwarden-service
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: vaultwarden
|
||||
app.k8s.hty1024.com/version: 1.30.1-alpine
|
||||
app.k8s.hty1024.com/resources: service
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
nodePort: 30000
|
||||
selector:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: vaultwarden
|
||||
app.k8s.hty1024.com/version: 1.30.1-alpine
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
|
||||
---
|
||||
|
||||
# 创建 StatefulSet
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: hty1024-app-vaultwarden-statefulset
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: vaultwarden
|
||||
app.k8s.hty1024.com/version: 1.30.1-alpine
|
||||
app.k8s.hty1024.com/resources: statefulSet
|
||||
spec:
|
||||
replicas: 1
|
||||
minReadySeconds: 30
|
||||
selector:
|
||||
matchLabels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: vaultwarden
|
||||
app.k8s.hty1024.com/version: 1.30.1-alpine
|
||||
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: vaultwarden
|
||||
app.k8s.hty1024.com/version: 1.30.1-alpine
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 60
|
||||
volumes:
|
||||
- name: localtime
|
||||
hostPath:
|
||||
path: /etc/localtime
|
||||
- name: hty1024-app-vaultwarden-data
|
||||
persistentVolumeClaim:
|
||||
claimName: hty1024-app-vaultwarden-pvc
|
||||
containers:
|
||||
- name: vaultwarden
|
||||
image: vaultwarden/server:1.30.1-alpine
|
||||
ports:
|
||||
- name: tcp
|
||||
containerPort: 80
|
||||
volumeMounts:
|
||||
- name: localtime
|
||||
mountPath: /etc/localtime
|
||||
readOnly: true
|
||||
- name: hty1024-app-vaultwarden-data
|
||||
mountPath: /data
|
||||
env:
|
||||
- name: SIGNUPS_ALLOWED
|
||||
value: "false"
|
||||
nodeSelector:
|
||||
node.k8s.hty1024.com/type: app
|
||||
|
||||
176
examples/wikijs/wikijs.yaml
Normal file
176
examples/wikijs/wikijs.yaml
Normal file
@@ -0,0 +1,176 @@
|
||||
---
|
||||
|
||||
# 创建 Namespace
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: hty1024-app
|
||||
|
||||
---
|
||||
|
||||
# 创建 StorageClass
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: storage-local-wikijs
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: wikijs
|
||||
app.k8s.hty1024.com/version: 2.5.300
|
||||
app.k8s.hty1024.com/resources: storageClass
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
reclaimPolicy: Retain
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
|
||||
---
|
||||
|
||||
# 创建 PersistentVolume
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: hty1024-app-wikijs-pv
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: wikijs
|
||||
app.k8s.hty1024.com/version: 2.5.300
|
||||
app.k8s.hty1024.com/resources: persistentVolume
|
||||
spec:
|
||||
capacity:
|
||||
storage: 10Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: storage-local-wikijs
|
||||
local:
|
||||
path: /app/wikijs/data
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: node.k8s.hty1024.com/type
|
||||
operator: In
|
||||
values:
|
||||
- app
|
||||
|
||||
---
|
||||
|
||||
# 创建 PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: hty1024-app-wikijs-pvc
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: wikijs
|
||||
app.k8s.hty1024.com/version: 2.5.300
|
||||
app.k8s.hty1024.com/resources: persistentVolumeClaim
|
||||
spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: storage-local-wikijs
|
||||
|
||||
---
|
||||
|
||||
# 创建 Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hty1024-app-wikijs-service
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: wikijs
|
||||
app.k8s.hty1024.com/version: 2.5.300
|
||||
app.k8s.hty1024.com/resources: service
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- port: 3000
|
||||
targetPort: 3000
|
||||
nodePort: 30000
|
||||
selector:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: wikijs
|
||||
app.k8s.hty1024.com/version: 2.5.300
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
|
||||
---
|
||||
|
||||
# 创建 StatefulSet
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: hty1024-app-wikijs-statefulset
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: wikijs
|
||||
app.k8s.hty1024.com/version: 2.5.300
|
||||
app.k8s.hty1024.com/resources: statefulSet
|
||||
spec:
|
||||
replicas: 1
|
||||
minReadySeconds: 30
|
||||
selector:
|
||||
matchLabels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: wikijs
|
||||
app.k8s.hty1024.com/version: 2.5.300
|
||||
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: wikijs
|
||||
app.k8s.hty1024.com/version: 2.5.300
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 60
|
||||
volumes:
|
||||
- name: localtime
|
||||
hostPath:
|
||||
path: /etc/localtime
|
||||
- name: hty1024-app-wikijs-data
|
||||
persistentVolumeClaim:
|
||||
claimName: hty1024-app-wikijs-pvc
|
||||
containers:
|
||||
- name: wikijs
|
||||
image: requarks/wiki:2.5.300
|
||||
ports:
|
||||
- name: tcp
|
||||
containerPort: 3000
|
||||
volumeMounts:
|
||||
- name: localtime
|
||||
mountPath: /etc/localtime
|
||||
readOnly: true
|
||||
- name: hty1024-app-wikijs-data
|
||||
mountPath: /wiki/data
|
||||
env:
|
||||
- name: DB_TYPE
|
||||
value: "mysql"
|
||||
- name: DB_HOST
|
||||
value: "hty1024-db-mysql-service.hty1024-db"
|
||||
- name: DB_PORT
|
||||
value: "3306"
|
||||
- name: DB_USER
|
||||
value: "wikijs"
|
||||
- name: DB_PASS
|
||||
value: "123456"
|
||||
- name: DB_NAME
|
||||
value: "wikijs"
|
||||
nodeSelector:
|
||||
node.k8s.hty1024.com/type: app
|
||||
|
||||
163
examples/wiznote/wiznote.yaml
Normal file
163
examples/wiznote/wiznote.yaml
Normal file
@@ -0,0 +1,163 @@
|
||||
---
|
||||
|
||||
# 创建 Namespace
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: hty1024-app
|
||||
|
||||
---
|
||||
|
||||
# 创建 StorageClass
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: storage-local-wiznote
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: wiznote
|
||||
app.k8s.hty1024.com/version: 1.0.31
|
||||
app.k8s.hty1024.com/resources: storageClass
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
reclaimPolicy: Retain
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
|
||||
---
|
||||
|
||||
# 创建 PersistentVolume
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: hty1024-app-wiznote-pv
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: wiznote
|
||||
app.k8s.hty1024.com/version: 1.0.31
|
||||
app.k8s.hty1024.com/resources: persistentVolume
|
||||
spec:
|
||||
capacity:
|
||||
storage: 20Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: storage-local-wiznote
|
||||
local:
|
||||
path: /app/wiznote/data
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: node.k8s.hty1024.com/type
|
||||
operator: In
|
||||
values:
|
||||
- app
|
||||
|
||||
---
|
||||
|
||||
# 创建 PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: hty1024-app-wiznote-pvc
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: wiznote
|
||||
app.k8s.hty1024.com/version: 1.0.31
|
||||
app.k8s.hty1024.com/resources: persistentVolumeClaim
|
||||
spec:
|
||||
resources:
|
||||
requests:
|
||||
storage: 20Gi
|
||||
volumeMode: Filesystem
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: storage-local-wiznote
|
||||
|
||||
---
|
||||
|
||||
# 创建 Service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hty1024-app-wiznote-service
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: wiznote
|
||||
app.k8s.hty1024.com/version: 1.0.31
|
||||
app.k8s.hty1024.com/resources: service
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
nodePort: 30000
|
||||
selector:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: wiznote
|
||||
app.k8s.hty1024.com/version: 1.0.31
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
|
||||
---
|
||||
|
||||
# 创建 StatefulSet
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: hty1024-app-wiznote-statefulset
|
||||
namespace: hty1024-app
|
||||
labels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: wiznote
|
||||
app.k8s.hty1024.com/version: 1.0.31
|
||||
app.k8s.hty1024.com/resources: statefulSet
|
||||
spec:
|
||||
replicas: 1
|
||||
minReadySeconds: 30
|
||||
selector:
|
||||
matchLabels:
|
||||
app.k8s.hty1024.com/env: prod
|
||||
app.k8s.hty1024.com/type: app
|
||||
app.k8s.hty1024.com/name: wiznote
|
||||
app.k8s.hty1024.com/version: 1.0.31
|
||||
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: wiznote
|
||||
app.k8s.hty1024.com/version: 1.0.31
|
||||
app.k8s.hty1024.com/resources: pod
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 60
|
||||
volumes:
|
||||
- name: localtime
|
||||
hostPath:
|
||||
path: /etc/localtime
|
||||
- name: hty1024-app-wiznote-data
|
||||
persistentVolumeClaim:
|
||||
claimName: hty1024-app-wiznote-pvc
|
||||
containers:
|
||||
- name: wiznote
|
||||
image: hub.hty1024.com/official/wiznote/wizserver:1.0.31
|
||||
ports:
|
||||
- name: tcp
|
||||
containerPort: 80
|
||||
volumeMounts:
|
||||
- name: localtime
|
||||
mountPath: /etc/localtime
|
||||
readOnly: true
|
||||
- name: hty1024-app-wiznote-data
|
||||
mountPath: /wiz/storage
|
||||
nodeSelector:
|
||||
node.k8s.hty1024.com/type: app
|
||||
|
||||
Reference in New Issue
Block a user