service-apollo-admin-server-test-alpha.yaml 3.5 KB
Newer Older
A
AIOT 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13

---
# configmap for apollo-admin-server-test-alpha
kind: ConfigMap
apiVersion: v1
metadata:
  namespace: sre
  name: configmap-apollo-admin-server-test-alpha
data:
  application-github.properties: |
    spring.datasource.url = jdbc:mysql://service-mysql-for-apollo-test-alpha-env.sre:3306/TestAlphaApolloConfigDB?characterEncoding=utf8
    spring.datasource.username = FillInCorrectUser
    spring.datasource.password = FillInCorrectPassword
14
    eureka.service.url = http://statefulset-apollo-config-server-test-alpha-0.service-apollo-meta-server-test-alpha:8080/eureka/,http://statefulset-apollo-config-server-test-alpha-1.service-apollo-meta-server-test-alpha:8080/eureka/,http://statefulset-apollo-config-server-test-alpha-2.service-apollo-meta-server-test-alpha:8080/eureka/
A
AIOT 已提交
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

---
kind: Service
apiVersion: v1
metadata:
  namespace: sre
  name: service-apollo-admin-server-test-alpha
  labels:
    app: service-apollo-admin-server-test-alpha
spec:
  ports:
    - protocol: TCP
      port: 8090
      targetPort: 8090
  selector:
    app: pod-apollo-admin-server-test-alpha
  type: ClusterIP
  sessionAffinity: ClientIP

---
kind: Deployment
36
apiVersion: apps/v1
A
AIOT 已提交
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
metadata:
  namespace: sre
  name: deployment-apollo-admin-server-test-alpha
  labels:
    app: deployment-apollo-admin-server-test-alpha
spec:
  replicas: 3
  selector:
    matchLabels:
      app: pod-apollo-admin-server-test-alpha
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: pod-apollo-admin-server-test-alpha
    spec:
57 58 59 60 61 62 63 64 65 66 67 68
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - pod-apollo-admin-server-test-alpha
              topologyKey: kubernetes.io/hostname
A
AIOT 已提交
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
      
      volumes:
        - name: volume-configmap-apollo-admin-server-test-alpha
          configMap:
            name: configmap-apollo-admin-server-test-alpha
            items:
              - key: application-github.properties
                path: application-github.properties
      
      initContainers:
        - image: alpine-bash:3.8
          name: check-service-apollo-config-server-test-alpha
          command: ['bash', '-c', "curl --connect-timeout 2 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 service-apollo-config-server-test-alpha.sre:8080"]
      
      containers:
        - image: apollo-admin-server:v1.0.0
          securityContext:
            privileged: true
          imagePullPolicy: IfNotPresent
          name: container-apollo-admin-server-test-alpha
          ports:
            - protocol: TCP
              containerPort: 8090
          
          volumeMounts:
            - name: volume-configmap-apollo-admin-server-test-alpha
              mountPath: /apollo-admin-server/config/application-github.properties
              subPath: application-github.properties
          
          env:
            - name: APOLLO_ADMIN_SERVICE_NAME
              value: "service-apollo-admin-server-test-alpha.sre"
          
          readinessProbe:
            tcpSocket:
              port: 8090
            initialDelaySeconds: 10
            periodSeconds: 5
          
          livenessProbe:
            tcpSocket:
              port: 8090
            initialDelaySeconds: 120
            periodSeconds: 10
          
      dnsPolicy: ClusterFirst
      restartPolicy: Always