Administrator
Administrator
发布于 2025-07-14 / 16 阅读
0
0

Kubernetes YAML模板文件

1:Deployment YAML模板文件
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ruoyi-gateway
  namespace: default
  labels:
    app: ruoyi-gateway
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ruoyi-gateway
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
      name: ruoyi-gateway
      namespace: default
      labels:
        app: ruoyi-gateway
    spec:
      affinity: {}
      containers:
      - image: swr.cn-east-3.myhuaweicloud.com/beijia/ruoyi-gateway:1750218369
        name: ruoyi-gateway
        ports:
        - containerPort: 8080
          protocol: TCP
        imagePullPolicy: IfNotPresent
        lifecycle:
          preStop:
            exec:
              command: ["/bin/sh", "-c", "sleep 10"]
        livenessProbe:
          httpGet:
            path: actuator/health
            port: 8080
            scheme:  HTTP
          periodSeconds: 5
          successThreshold: 1
          timeoutSeconds: 1
        readinessProbe:
          httpGet:
            path: actuator/health
            port: 8080
            scheme:  HTTP
          periodSeconds: 5
          successThreshold: 1
          timeoutSeconds: 1
        resources:
          limits:
            cpu: '4'
            memory: 4Gi
          requests:
            cpu: '2'
            memory: 2Gi
      imagePullSecrets:
      - name: s-htrwb
      dnsPolicy: ClusterFirst
      restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
  name: ruoyi-gateway
  namespace: default
  labels:
    app: ruoyi-gateway
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 8080
  selector:
      app: ruoyi-gateway
  type: ClusterIP


评论