kubernetes / minikube

Run Kubernetes locally
https://minikube.sigs.k8s.io/
Apache License 2.0
29.15k stars 4.87k forks source link

Aparent inconsistence between the time displayed by the Linux date command and the one obtained by a running pod #19361

Open nicolasduminil opened 1 month ago

nicolasduminil commented 1 month ago

What Happened?

I'm running minikube 1.32.0 on Ubuntu 22.04.4 LTS. The file ~/.minikube/files/etc/localtime has been configured with the CEST time zone. I can check that as follows:

$ minikube ssh
docker@minikube:~$ date
Thu Aug  1 17:58:31 CEST 2024

I have a deployed a pod that returns the system current date and time. The Java code is below:

return LocalDateTime.now().format(...); 

However, this returns Thu Aug 1 15:58:31 CEST 2024 instead of Thu Aug 1 17:58:31 CEST 2024 . So, the date and time returned by the Linux date command is different from the one returned by the pod running in the cluster.

I have the following locale:

On the host machine:

$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=fr_FR.UTF-8
LC_TIME=fr_FR.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=fr_FR.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=fr_FR.UTF-8
LC_NAME=fr_FR.UTF-8
LC_ADDRESS=fr_FR.UTF-8
LC_TELEPHONE=fr_FR.UTF-8
LC_MEASUREMENT=fr_FR.UTF-8
LC_IDENTIFICATION=fr_FR.UTF-8
LC_ALL=

On the cluster:

$ locale
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX" 
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

By setting the file ~/.minikube/files/etc/localtime I would have expected that the cluster locale be the same as the host machine. But obviously not. However, the date command show the CEST locale.

What might be the problem here ?

Attach the log file

log.txt

Operating System

Ubuntu

Driver

Docker

nicolasduminil commented 3 weeks ago

Anyone concerned there ?