Skip to content

Kubernetes Pod Timezone Değiştirme

Cluster içerisinde çalışan podumuzun bazen timezone ayarını manuel olarak değiştirmemiz gerekebilir. Bu gibi durumda deploy dosyamızda, volume olarak timozone ekleyebiliriz.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: busybox-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: busybox
  template:
    metadata:
      labels:
        app: busybox
    spec:
      volumes:
        - name: tz-config
          hostPath:
            path: /usr/share/zoneinfo/Europe/Istanbul
      containers:
        - name: busybox
          image: busybox:latest
          volumeMounts:
            - name: tz-config
              mountPath: /etc/localtime
          command: ["/bin/sh", "-c", "while true; do echo Hello Kubernetes; date; sleep 60; done"]

Örnek bir busybox deployment için yukarıdaki şekilde varsayabiliriz.

Ek;

kubectl exec -it <pod-name> -- /bin/sh

>> date
Published inkubernetes

Comments are closed.