version: "3.9"
services:
wikijs:
image: requarks/wiki:2.5.300
container_name: wikijs
hostname: wikijs
restart: always
networks:
- db_network
- app_network
volumes:
- /etc/localtime:/etc/localtime:ro
- ./conf/config.yml:/wiki/config.yml:ro
- ./data:/wiki/data
networks:
db_network:
external: true
name: db_network
app_network:
external: true
name: app_network
参考: https://git.hty1024.com/HTY1024/kubernetes-yaml/src/branch/main/examples/wikijs/wikijs.yaml
---
# 创建 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
> 内容
内容
> 内容
{.is-info}
内容
> 内容
{.is-success}
内容
> 内容
{.is-warning}
内容
> 内容
{.is-danger}
内容
- 内容1
- 内容2
- 内容3
- 内容1
- 内容2
- 内容3
{.grid-list}
- [名称1 *内容1*](链接1)
- [名称2 *内容2*](链接2)
- [名称3 *内容3*](链接3)
{.links-list}
:名称:
:apple:
:cat:
<kbd>按键</kbd>
<kbd>CTRL</kbd>
CTRL
<kbd>C</kbd>
C
<ruby>
中<rp>(</rp><rt>ちゅう</rt><rp>)</rp>
国<rp>(</rp><rt>ごく</rt><rp>)</rp>
</ruby>
中
国
中国<sup>①</sup>
中国①
中国<sub>②</sub>
中国②