添加docker部署文件
This commit is contained in:
parent
3e67b0d2a5
commit
3359aebb33
3
Dockerfile
Normal file
3
Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM registry.cn-hangzhou.aliyuncs.com/axzo-k8s/jdk1.8-fc:v1
|
||||
COPY nanopart-server/target/nanopart-server.jar ./nanopart-server.jar
|
||||
ENTRYPOINT [{ENTRYPOINT}]
|
||||
@ -24,14 +24,14 @@
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.axzo.nanopart</groupId>
|
||||
<artifactId>black-list-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.axzo.basics</groupId>
|
||||
<artifactId>basics-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.axzo.nanopart</groupId>
|
||||
<artifactId>black-list-api</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
121
deployment.yaml
Normal file
121
deployment.yaml
Normal file
@ -0,0 +1,121 @@
|
||||
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: harbor.axzo.cn/{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
|
||||
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: harbor
|
||||
volumes:
|
||||
- name: tz-config
|
||||
hostPath:
|
||||
path: /usr/share/zoneinfo/Asia/Shanghai
|
||||
- name: jmx-exporter
|
||||
persistentVolumeClaim:
|
||||
claimName: jmx
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: { ProjectName }
|
||||
spec:
|
||||
ports:
|
||||
- name: tcp
|
||||
port: { port }
|
||||
clusterIP: None
|
||||
selector:
|
||||
app: { ProjectName }
|
||||
Loading…
Reference in New Issue
Block a user