yaml模板

警告
本文最后更新于 2020-07-06 16:07,文中内容可能已过时。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
apiVersion: v1
kind: Service
metadata:
  labels:
    app: gateway
  name: gateway
  namespace: {nameSpace}
spec:
  ports:
  - name: gateway
    port: 80
    protocol: TCP
    targetPort: http
  selector:
    app: gateway
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: gateway
  namespace: {nameSpace}
spec:
  replicas: {replicas}
  selector:
    matchLabels:
      app: gateway
  template:
    metadata:
      labels:
        app: gateway
    spec:
      imagePullSecrets:
      - name: registry-secret
      containers:
      - name: gateway
        resources:
         requests:
           cpu: {request_cpu}
           memory: {request_memory}
         limits:
           cpu: {limit_cpu}
           memory: {limit_memory}
        image: {imageName}
        ports:
        - containerPort: 80
          name: http
        env:
        - name: JAVA_OPTS
          value: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MinRAMPercentage=70.0 -XX:MaxRAMPercentage=80.0 -XX:+HeapDumpOnOutOfMemoryError"
        command: ["/bin/sh"]
        args: ["-c","java $JAVA_OPTS -Dspring.profiles.active={deployEnv} -Djava.security.egd=file:/dev/./urandom -jar /gateway.jar"]
        readinessProbe:
          httpGet:
            path: /actuator/info
            port: http
            scheme: HTTP
          initialDelaySeconds: 30
          periodSeconds: 30
          failureThreshold: 5
          successThreshold: 1
          timeoutSeconds: 30
        livenessProbe:
          httpGet:
            path: /actuator/info
            port: http
            scheme: HTTP
          initialDelaySeconds: 60
          periodSeconds: 30
          failureThreshold: 3
          successThreshold: 1
          timeoutSeconds: 30
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: gateway
  namespace: {nameSpace}
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/use-regex: "true"
spec:
  rules:
  - host: {domainName}
    http:
      paths:
      - backend:
          serviceName: gateway
          servicePort: gateway
请我喝杯水
SoulChild 微信号 微信号
SoulChild 微信打赏 微信打赏
0%