123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- #
- # Copyright 2021 Apollo Authors
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- #
- ---
- # 为外部 mysql 服务设置 service
- kind: Service
- apiVersion: v1
- metadata:
- namespace: sre
- name: service-mysql-for-portal-server
- labels:
- app: service-mysql-for-portal-server
- spec:
- ports:
- - protocol: TCP
- port: 3306
- targetPort: 3306
- type: ClusterIP
- sessionAffinity: None
- ---
- kind: Endpoints
- apiVersion: v1
- metadata:
- namespace: sre
- name: service-mysql-for-portal-server
- subsets:
- - addresses:
- # 更改为你的 mysql addresses, 例如 1.1.1.1
- - ip: your-mysql-addresses
- ports:
- - protocol: TCP
- port: 3306
- ---
- # configmap for apollo-portal-server
- kind: ConfigMap
- apiVersion: v1
- metadata:
- namespace: sre
- name: configmap-apollo-portal-server
- data:
- application-github.properties: |
- spring.datasource.url = jdbc:mysql://service-mysql-for-portal-server.sre:3306/ApolloPortalDB?characterEncoding=utf8
- # mysql username
- spring.datasource.username = FillInCorrectUser
- # mysql password
- spring.datasource.password = FillInCorrectPassword
- # enabled environments
- apollo.portal.envs = dev,fat,uat,pro
- apollo-env.properties: |
- dev.meta=http://service-apollo-config-server-dev.sre:8080
- fat.meta=http://service-apollo-config-server-fat.sre:8080
- uat.meta=http://service-apollo-config-server-uat.sre:8080
- pro.meta=http://service-apollo-config-server-prod.sre:8080
- ---
- kind: Service
- apiVersion: v1
- metadata:
- namespace: sre
- name: service-apollo-portal-server
- labels:
- app: service-apollo-portal-server
- spec:
- ports:
- - protocol: TCP
- port: 8070
- targetPort: 8070
- nodePort: 30001
- selector:
- app: pod-apollo-portal-server
- type: NodePort
- # portal session 保持
- sessionAffinity: ClientIP
- ---
- kind: Deployment
- apiVersion: apps/v1
- metadata:
- namespace: sre
- name: deployment-apollo-portal-server
- labels:
- app: deployment-apollo-portal-server
- spec:
- # 2 个实例
- replicas: 2
- selector:
- matchLabels:
- app: pod-apollo-portal-server
- strategy:
- rollingUpdate:
- maxSurge: 1
- maxUnavailable: 1
- type: RollingUpdate
- template:
- metadata:
- labels:
- app: pod-apollo-portal-server
- spec:
- affinity:
- podAntiAffinity:
- preferredDuringSchedulingIgnoredDuringExecution:
- - weight: 100
- podAffinityTerm:
- labelSelector:
- matchExpressions:
- - key: app
- operator: In
- values:
- - pod-apollo-portal-server
- topologyKey: kubernetes.io/hostname
-
- volumes:
- - name: volume-configmap-apollo-portal-server
- configMap:
- name: configmap-apollo-portal-server
- items:
- - key: application-github.properties
- path: application-github.properties
- - key: apollo-env.properties
- path: apollo-env.properties
- containers:
- - image: apolloconfig/apollo-portal:1.9.2
- securityContext:
- privileged: true
- imagePullPolicy: IfNotPresent
- name: container-apollo-portal-server
- ports:
- - protocol: TCP
- containerPort: 8070
-
- volumeMounts:
- - name: volume-configmap-apollo-portal-server
- mountPath: /apollo-portal/config/application-github.properties
- subPath: application-github.properties
- - name: volume-configmap-apollo-portal-server
- mountPath: /apollo-portal/config/apollo-env.properties
- subPath: apollo-env.properties
-
- env:
- - name: APOLLO_PORTAL_SERVICE_NAME
- value: "service-apollo-portal-server.sre"
-
- readinessProbe:
- tcpSocket:
- port: 8070
- initialDelaySeconds: 10
- periodSeconds: 5
-
- livenessProbe:
- tcpSocket:
- port: 8070
- # 120s 内, server 未启动则重启 container
- initialDelaySeconds: 120
- periodSeconds: 15
-
- dnsPolicy: ClusterFirst
- restartPolicy: Always
|