yaml格式的常用Deployment+Service

 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
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cmdb-neo4j-glusterfs
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cmdb-neo4j-glusterfs
  template:
    metadata:
      labels:
        app: cmdb-neo4j-glusterfs
    spec:
      containers:
      - image: dockerhub.com/cmdb/neo4j:3.5.3
        imagePullPolicy: Always
        name: cmdb-neo4j-glusterfs
        env:
          - name: NEO4J_dbms_memory_heap_max__size
            valueFrom:
              configMapKeyRef:
                name: neo4j-confvalue
                key: max 
          - name: NEO4J_dbms_memory_heap_initial__size 
            valueFrom:
              configMapKeyRef:
                name: neo4j-confvalue
                key: init 
          - name: NEO4J_dbms_unmanaged__extension__classes 
            valueFrom:
              configMapKeyRef:
                name: neo4j-plugin
                key: plugin
          - name: NEO4J_dbms_security_procedures_unrestricted
            value: "graphql.*"
          - name: NEO4J_dbms_security_procedures_whitelist
            value: "graphql.*" 
        volumeMounts:
        - mountPath: /data
          name: datas
        - mountPath: /var/lib/neo4j/plugins
          name: plugins 
        ports:
        - containerPort: 7474
          name: one
          protocol: TCP
        - containerPort: 7687
          name: two
          protocol: TCP
      volumes:
      - name: plugins
        persistentVolumeClaim:
          claimName: neo4j-plugin-20g
      - name: datas 
        persistentVolumeClaim:
          claimName: neo4j-data-200g
      imagePullSecrets:
      - name: harbor
      nodeSelector:
        kubernetes.io/role: node
      restartPolicy: Always
---
kind: Service
apiVersion: v1
metadata:
  name: cmdb-neo4j-glusterfs
spec:
  selector:
    app: cmdb-neo4j-glusterfs
  ports:
  - name: http
    protocol: TCP
    port: 7687
    targetPort: 7687
  - name: web
    protocol: TCP
    port: 7474
    targetPort: 7474
  externalIPs:
  - 10.2.5.10