zadig deployment 模板


 

 

 

zadig  deployment 模板

 

 

Java  模板

 

 

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: spring-configmap
data:
  DEPLOYMENT_ENV: {{.DeploymentEnv}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: $T-Service$
  labels: 
    app.kubernetes.io/name: $T-Project$
    app.kubernetes.io/instance: $T-Service$
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: $T-Project$
      app.kubernetes.io/instance: $T-Service$
  replicas: 1
  template:
    metadata: 
      labels:
        app.kubernetes.io/name: $T-Project$
        app.kubernetes.io/instance: $T-Service$
    spec:
      restartPolicy: Always
      imagePullSecrets:
        - name: pulluser
      containers:
      - name: $T-Service$
        image: harbor.qumaipiao.net/dev/$T-Service$:latest
        imagePullPolicy: IfNotPresent
        args: ["--spring.profiles.active=$(DEPLOYMENT_ENV_KEY)"]
        env:
          - name: DEPLOYMENT_ENV_KEY
            valueFrom:
              configMapKeyRef:
                name: spring-configmap
                key: DEPLOYMENT_ENV
        workingDir: /data
        command:
          - /usr/bin/java
          - -Djava.security.egd=file:/dev/./urandom
          - -Duser.timezone=Asia/Shanghai
          - -jar
          - /data/app.jar
        ports:
        - name: liveness-port
          containerPort: {{.ContainerPort}}
        livenessProbe:
          tcpSocket:
            port: liveness-port
          initialDelaySeconds: 10
          periodSeconds: 30
        startupProbe:
          tcpSocket:
            port: liveness-port
          failureThreshold: 30
          periodSeconds: 10
        readinessProbe:
          tcpSocket:
            port: liveness-port
          initialDelaySeconds: 10
          periodSeconds: 20
        resources:
          resources:
            limits:
              memory: {{.memoryLimit}} 
---
apiVersion: v1
kind: Service
metadata:
  name: $T-Service$
  labels:
    app.kubernetes.io/name: $T-Project$
    app.kubernetes.io/instance: $T-Service$
spec:
  type: NodePort
  ports:
    - protocol: TCP
      port: 80
      targetPort: {{.ContainerPort}}

 

 

 

 

node 模板

 

apiVersion: apps/v1
kind: Deployment
metadata:
  name: $T-Service$
  labels: 
    app.kubernetes.io/name: $T-Project$
    app.kubernetes.io/instance: $T-Service$
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: $T-Project$
      app.kubernetes.io/instance: $T-Service$
  replicas: 2
  template:
    metadata: 
      labels:
        app.kubernetes.io/name: $T-Project$
        app.kubernetes.io/instance: $T-Service$
    spec:
      imagePullSecrets:
        - name: pulluser
      containers:
        - image: harbor.qumaipiao.net/dev/$T-Service$:latest
          name: $T-Service$
          ports:
            - protocol: TCP
              containerPort: {{.port}}
          imagePullPolicy: IfNotPresent              
          readinessProbe:
            failureThreshold: 3
            initialDelaySeconds: 5
            periodSeconds: 10
            httpGet:
              port: 80
              path: /
          lifecycle:
            preStop:
              exec:
                command: [
                    "sh", "-c",
                    "sleep 15 && /usr/sbin/nginx -s quit",
                ]
          resources:
            requests:
              cpu: {{.cpuLimit}}
              memory: {{.memoryLimit}}
      restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
  name: $T-Service$
  labels:
    app.kubernetes.io/name: $T-Project$
    app.kubernetes.io/instance: $T-Service$
spec:
  type: NodePort
  ports:
    - protocol: TCP
      port: {{.port}}
      targetPort: {{.port}}

  

 

 

 

 

 

 

 

 

 

  

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/279118.html

(0)
上一篇 2022年8月5日 20:52
下一篇 2022年8月5日 21:07

相关推荐

发表回复

登录后才能评论