kind: Deployment
apiVersion: apps/v1
metadata:
name: halo-dep
namespace: wanna-project
creationTimestamp: '2024-10-30T20:22:00Z'
labels:
app: halo-dep
annotations:
deployment.kubernetes.io/revision: '59'
kubesphere.io/alias-name: halo-dep
kubesphere.io/creator: admin
kubesphere.io/description: halo-dep
spec:
replicas: 3
selector:
matchLabels:
app: halo-dep
template:
metadata:
creationTimestamp: null
labels:
app: halo-dep
annotations:
kubesphere.io/creator: admin
kubesphere.io/imagepullsecrets: '{"halo-dep-riiqgv":"wanna-project-harbor"}'
kubesphere.io/restartedAt: '2024-11-01T19:47:02.315Z'
logging.kubesphere.io/logsidecar-config: '{}'
spec:
volumes:
- name: host-time
hostPath:
path: /etc/localtime
type: ''
- name: volume-d89mhc
configMap:
name: halo-application-prod
defaultMode: 420
- name: volume-nfs
persistentVolumeClaim:
claimName: nfs-pvc-2
containers:
- name: halo-dep-riiqgv
image: 'wanna1314y.top:1443/library/halo:latest'
command:
- /bin/sh
- '-c'
args:
- >-
java ${JVM_OPTS}
org.springframework.boot.loader.launch.JarLauncher ${0} ${@}
--spring.profiles.active=prod
--spring.config.additional-location=optional:/halo/config/application-prod.properties
ports:
- name: tcp-8090
containerPort: 8090
protocol: TCP
env:
- name: HALO_WORK_DIR
value: /halo/nfssharedata/.halo2
resources: {}
volumeMounts:
- name: host-time
readOnly: true
mountPath: /etc/localtime
# 挂载本地配置文件
- name: volume-d89mhc
readOnly: true
mountPath: /halo/config/application-prod.properties
subPath: application-prod.properties
# 挂载持久卷存放Halo的仓库数据
- name: volume-nfs
mountPath: /halo/nfssharedata
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
serviceAccountName: default
serviceAccount: default
securityContext: {}
imagePullSecrets:
- name: wanna-project-harbor
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600
定义PV持久卷。
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs-pv
spec:
capacity:
storage: 5Gi # 根据需要调整存储大小
accessModes:
- ReadWriteMany # NFS 通常使用 ReadWriteMany 访问模式
nfs:
path: /nfssharedata # NFS 服务器上共享的目录路径
server: 49.7.208.137 # NFS 服务器的 IP 地址
定义PVC持久卷声明
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: nfs-pvc
namespace: wanna-project
spec:
accessModes:
- ReadWriteMany # 确保与 PV 的访问模式匹配
resources:
requests:
storage: 5Gi # 请求的存储大小
评论