一般从hub.docker.com下载的镜像是没有设置时区的,想让镜像与本时区一致,将本地时区文件做为volume挂载到容器中即可

apiVersion: apps/v1
kind: Deployment
metadata:
  name: user
  namespace: test
  labels:
    app: user
spec:
  replicas: 1
  selector:
    matchLabels:
      app: user
  template:
    metadata:
      labels:
        app: user
    spec:
      containers:
      - name: user
        image: sw-user:3.0
        ports:
        - containerPort: 8080
        volumeMounts:
        - name: localtime
          mountPath: /etc/localtime
      volumes:
      - name: localtime
        hostPath:
          path: /etc/localtime

 

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐