apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: doctor-strange
name: doctor-strange
namespace: closeli
spec:
replicas: 1
selector:
matchLabels:
app: doctor-strange
template:
metadata:
labels:
app: doctor-strange
spec:
imagePullSecrets:
- name: harbor-key
nodeSelector:
closeli: 'public'
kubernetes.io/os: linux
dnsConfig:
options:
- name: ndots
value: "2"
containers:
- image: harbor-ops.closeli.cn/doctor-strange-deb/doctor-strange:latest
name: doctor-strange
imagePullPolicy: Always
env:
- name: MY_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: MY_POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: MY_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: HOST_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
command: ['sh']
args:
- "-c"
- |
set -x
rm -rf /mnt/doctor-strange/doctor-strange-$(MY_POD_IP)
rm -rf /mnt/doctor-strangeconf/doctor-strangeconf-$(MY_POD_IP)
mkdir -p /mnt/doctor-strange/doctor-strange-$(MY_POD_IP)
mkdir -p /mnt/doctor-strangeconf/doctor-strangeconf-$(MY_POD_IP)
cp /tmp/doctor-strangeconf/application.properties /mnt/doctor-strangeconf/doctor-strangeconf-$(MY_POD_IP)
ln -s /mnt/doctor-strange/doctor-strange-$(MY_POD_IP) /usr/local/doctor-strange/logs
ln -s /mnt/doctor-strangeconf/doctor-strangeconf-$(MY_POD_IP) /opt/doctor-strangeconf
cd /usr/local/doctor-strange/
java -Duser.timezone=GMT+08 -Dfile.encoding=UTF-8 -jar /usr/local/doctor-strange/doctorstrange.jar -server -Xms1024m -Xmx1024m -Xss512k -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSPaeemarkEnabled -XXHeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/usr/local/doctor-strange/logs --spring.config.location=/opt/doctor-strangeconf/application.properties --server.port=8090
livenessProbe:
httpGet:
path: /version
port: 8090
initialDelaySeconds: 15
periodSeconds: 5
timeoutSeconds: 5
failureThreshold: 3
successThreshold: 1
volumeMounts:
- name: doctor-strange-conf-nfs
mountPath: /tmp/doctor-strangeconf
- name: doctor-strange-conf
mountPath: /mnt/doctor-strangeconf
- name: doctor-strange-log
mountPath: /mnt/doctor-strange
volumes:
- name: doctor-strange-conf-nfs
nfs:
server: 10.83.0.116
path: /data/nfs/conf/doctor-strange
- name: doctor-strange-conf
hostPath:
path: /data/closeli/config/doctor-strange
- name: doctor-strange-log
hostPath:
path: /data/closeli/logs/doctor-strange