注: 仅自己备用
1、pod
apiVersion: v1
kind: Pod
metadata:
name: plato
labels:
app: plato
spec:
containers:
- name: plato
image: ccr.ccs.tencentyun.com/chens/plato:jenkins-plato-test-15-427d21f0
imagePullPolicy: IfNotPresent
volumeMounts:
- name: soc-pla-path
mountPath: /biz-code/plato/
restartPolicy: Never
volumes:
- name: soc-pla-path
hostPath:
path: /plato
type: Directory
2、deploy
apiVersion: apps/v1
kind: Deployment
metadata:
name: socrates
labels:
app: socrates
env: release
spec:
selector:
matchLabels:
app: socrates
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
# minReadySeconds: 30
template:
metadata:
labels:
app: socrates
spec:
containers:
- name: filebeat
image: registry.cn-beijing.aliyuncs.com/dotbalo/filebeat:7.10.2
resources:
requests:
memory: "100Mi"
cpu: "10m"
limits:
cpu: "200m"
memory: "300Mi"
imagePullPolicy: IfNotPresent
env:
- name: podIp
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
- name: podName
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: podNamespace
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: podDeployName
value: socrates
- name: TZ
value: "Asia/Shanghai"
securityContext:
runAsUser: 0
volumeMounts:
- name: logpath
mountPath: /data/log/
- name: filebeatconf
mountPath: /usr/share/filebeat/filebeat.yml
subPath: usr/share/filebeat/filebeat.yml
- name: socrates
image: ccr.ccs.tencentyun.com/chens/socrates:jenkins-socrates-test-45-4450adbbaa
imagePullPolicy: IfNotPresent
volumeMounts:
- name: logpath
mountPath: /biz-code/socrates/runtime/
- name: plato-vue
mountPath: /biz-code/socrates/public/vue
- name: plato-src
mountPath: /biz-code/socrates/public/src
- name: plato-index
mountPath: /biz-code/socrates/public/index.html
env:
- name: TZ
value: "Asia/Shanghai"
- name: LANG
value: C.UTF-8
- name: LC_ALL
value: C.UTF-8
livenessProbe:
failureThreshold: 2
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 80
timeoutSeconds: 2
ports:
- containerPort: 80
name: web
protocol: TCP
readinessProbe:
failureThreshold: 2
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 80
timeoutSeconds: 2
resources:
limits:
cpu: 994m
memory: 1170Mi
requests:
cpu: 300m
memory: 300Mi
dnsPolicy: ClusterFirst
imagePullSecrets:
- name: qcloudregistrykey
restartPolicy: Always
securityContext: {}
serviceAccountName: default
volumes:
- name: logpath
emptyDir: {}
- name: filebeatconf
configMap:
name: filebeatconf
items:
- key: filebeat.yml
path: usr/share/filebeat/filebeat.yml
- name: plato-vue
hostPath:
path: /plato/vue
type: Directory
- name: plato-src
hostPath:
path: /plato/src
type: Directory
- name: plato-index
hostPath:
path: /plato/index.html
type: File
3、service
apiVersion: v1
kind: Service
metadata:
labels:
app: hume
name: hume-service
namespace: dev
spec:
ports:
- name: hume
port: 7777
protocol: TCP
targetPort: 7777
selector:
app: hume
sessionAffinity: None
type: NodePort
4、cronjob
apiVersion: batch/v1
kind: CronJob
metadata:
name: sync-stock-record
namespace: dev
labels:
app: sync-stock-record
spec:
schedule: "*/1 * * * *"
jobTemplate:
metadata:
spec:
template:
spec:
restartPolicy: Never
containers:
- name: counter
image: ccr.ccs.tencentyun.com/chens/marx:jenkins-marx-sync_stock_record-test-1-2982d99
volumeMounts:
- name: config
mountPath: /biz-code/config.yaml
subPath: config.yaml
# command: ["/bin/sh","-c","whoami;chmod +x sync_stock_record;pwd;ls;./sync-stock-record -time='-5' -c config.yaml"]
command: ["/bin/sh","-c","./sync_stock_record -time='-5' -c config.yaml"]
imagePullSecrets:
- name: qcloudregistrykey
volumes:
- name: config
configMap:
name: config
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 5