Java教程

zadig deployment 模板

本文主要是介绍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}}

  

 

 

 

 

 

 

 

 

 

  

这篇关于zadig deployment 模板的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!