通过挂载,把本地的/etc/localtime挂载到容器中:
apiVersion: apps/v1
kind: Deployment
metadata:name: seb-algorithmsnamespace: jiaoda
spec:replicas: 1selector:matchLabels:app: seb-algorithmstemplate:metadata:labels:app: seb-algorithmsspec:containers:- name: seb-algorithmsimage: 192.168.110.30/jiaoda/seb-algorithms:${IMAGE_BUILD}ports:- containerPort: 8080volumeMounts:- name: datasmountPath: /opt/modules- name: tzmountPath: /etc/localtimevolumes:- name: datasnfs:server: 192.168.110.38path: /nfs/data/seb-algorithms- name: tzhostPath:path: /etc/localtimednsPolicy: "None"dnsConfig:nameservers:- 10.96.0.10searches:- svc.cluster.local- cluster.local
---
apiVersion: v1
kind: Service
metadata:name: seb-algorithmsnamespace: jiaoda
spec:clusterIP: 10.108.239.63clusterIPs:- 10.108.239.63selector:app: seb-algorithmstype: NodePortports:- protocol: TCPport: 8080targetPort: 8080nodePort: 30148
EOF