add docker file&deployment.yaml
This commit is contained in:
parent
63e1584c85
commit
2cb591917d
3
Dockerfile
Normal file
3
Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM harbor.axzo.cn/images_base/jdk1.8-fc:v1
|
||||
COPY xlog-server/target/xlog-server.jar ./xlog-server.jar
|
||||
ENTRYPOINT [{ENTRYPOINT}]
|
||||
123
deployment.yaml
Normal file
123
deployment.yaml
Normal file
@ -0,0 +1,123 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {ProjectName}
|
||||
spec:
|
||||
minReadySeconds: 2
|
||||
replicas: 1
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 1
|
||||
maxUnavailable: 0
|
||||
type: RollingUpdate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {ProjectName}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {ProjectName}
|
||||
prometheus: {PROMETHEUS}
|
||||
logging: '{LOGGING}'
|
||||
spec:
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: work
|
||||
operator: In
|
||||
values:
|
||||
- {nodeSelector}
|
||||
podAntiAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- podAffinityTerm:
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: app
|
||||
operator: In
|
||||
values:
|
||||
- {ProjectName}
|
||||
topologyKey: kubernetes.io/hostname
|
||||
weight: 100
|
||||
terminationGracePeriodSeconds: 60 ##k8s将会给应用发送SIGTERM信号,可以用来正确、优雅地关闭应用,默认为30秒
|
||||
containers:
|
||||
- name: {ProjectName}
|
||||
image: registry.cn-hangzhou.aliyuncs.com/axzo-k8s/{namespace}-{ProjectName}:{BUILD_ID}
|
||||
imagePullPolicy: Always
|
||||
livenessProbe: #该pod是存活的,不存活则需要重启
|
||||
httpGet:
|
||||
path: /checkDeath
|
||||
port: {port}
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 60 ## equals to the maximum startup time of the application + couple of seconds
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 5
|
||||
readinessProbe: #kubernetes认为该pod是启动成功的
|
||||
httpGet:
|
||||
path: /checkDeath
|
||||
port: {port}
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 30 ## equals to minimum startup time of the application
|
||||
timeoutSeconds: 5
|
||||
successThreshold: 1
|
||||
failureThreshold: 5
|
||||
volumeMounts:
|
||||
- name: tz-config
|
||||
mountPath: /etc/localtime
|
||||
- name: jmx-exporter
|
||||
mountPath: /data/jmx
|
||||
env:
|
||||
- name: NACOS_HOST
|
||||
value: {NACOS_HOST}
|
||||
- name: NACOS_PORT
|
||||
value: "{NACOS_PORT}"
|
||||
- name: NACOS_NAMESPACE_ID
|
||||
value: {NACOS_NAMESPACE_ID}
|
||||
- name: NACOS_PROFILES_ACTIVE
|
||||
value: {NACOS_PROFILES_ACTIVE}
|
||||
- name: MY_POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: MY_POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- name: POD_IP
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.podIP
|
||||
ports:
|
||||
- containerPort: {port}
|
||||
resources:
|
||||
limits:
|
||||
memory: {limitMemory}
|
||||
requests:
|
||||
memory: {requestsMemory}
|
||||
imagePullSecrets:
|
||||
- name: aliyun
|
||||
volumes:
|
||||
- name: tz-config
|
||||
hostPath:
|
||||
path: /usr/share/zoneinfo/Asia/Shanghai
|
||||
- name: jmx-exporter
|
||||
persistentVolumeClaim:
|
||||
claimName: jmx
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {ProjectName}
|
||||
labels:
|
||||
app: {ProjectName}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: {port}
|
||||
targetPort: {port}
|
||||
selector:
|
||||
app: {ProjectName}
|
||||
Loading…
Reference in New Issue
Block a user