Kubernetes Container Timezone Management


I want to show how to change the container’s timezone which runs on the Kubernetes cluster. Basically, when you push a docker image from the docker hub you can easily check which timezone already defined for the image. I just defined a basic YAML file, creates a container that sleeps “100000” seconds. We used BusyBox image.

BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc.

Default TimeZone:

Step 1: Create a test  POD definition file 

#cat /tmp/defaulttz.yaml
apiVersion: v1
kind: Pod
metadata:
  labels:
    run: defaulttz
  name: defaulttz
spec:
  containers:
  - image: busybox
    name: defaulttz
    args:
    - sleep
    - "100000"
#kubectl  create  -f  /tmp/defaulttz.yaml
pod/defaulttz created
#kubectl  get  pods
NAME        READY   STATUS    RESTARTS   AGE
defaulttz   1/1     Running   0          13s

Step 2: Deploy new POD without change 

When you create a new Pod with a POD definition file, it performs some steps like pull image, create container and start container etc.

#kubectl describe  pod defaulttz
.........
.........
  Type    Reason     Age        From               Message
  ----    ------     ----       ----               -------
  Normal  Scheduled  <unknown>  default-scheduler  Successfully assigned default/defaulttz to node01
  Normal  Pulling    2m30s      kubelet, node01    Pulling image "busybox"
  Normal  Pulled     2m24s      kubelet, node01    Successfully pulled image "busybox"
  Normal  Created    2m24s      kubelet, node01    Created container defaulttz
  Normal  Started    2m23s      kubelet, node01    Started container defaulttz

Now we can check the timezone variable for BusyBox image. First, you need to get a shell to the running container then run “date” command.

#kubectl exec  defaulttz  -it  --  /bin/sh
/ # date
Sat Dec 21 10:01:33 UTC 2019
/ # ls  -ld  /etc/localtime
-rw-r--r--    1 root     root           127 Sep 17 20:51 /etc/localtime
/ # strings  /etc/localtime
TZif2
TZif2
UTC0
/ #

New TimeZone:

Step 1: Create new POD definition file with spesific timezone.

Let’s try to change this timezone variable from UTC to GMT+3. We defined two variables that “volumeMounts” and “volumes”. A hostPath volume mounts a file or directory from the host node’s filesystem into your Pod. So we defined a new volume that shares the Timezone variable to the Pod. And we attached this volume to the container with volumeMounts method.

Connect one of the worker nodes that the container will schedule. You can define any timezone under this directory.

node01 $ ls  -ld /usr/share/zoneinfo/*
#cat /tmp/tzistanbul
apiVersion: v1
kind: Pod
metadata:
  name: tzistanbul
spec:
  containers:
  - name: tzistanbul
    image: busybox
    args:
    - sleep
    - "1000000"
    volumeMounts:
    - name: tz-istanbul
      mountPath: /etc/localtime
  volumes:
    - name: tz-istanbul
      hostPath:
        path: /usr/share/zoneinfo/Europe/Istanbul

Step 2: Deploy new POD

Now it’s time to create POD.

#kubectl create  -f  /tmp/tzistanbul
pod/tzistanbul created
#kubectl get  pods
NAME         READY   STATUS    RESTARTS   AGE
defaulttz    1/1     Running   0          13m
tzistanbul   1/1     Running   0          4s

Get a shell to the running Container:

#kubectl exec  tzistanbul  -it  --  /bin/sh

Step 3: Check TimeZone

Check if the container gets the timezone as you need.
/ # df -h /etc/localtime
Filesystem                Size      Used Available Use% Mounted on
/dev/vda1                44.1G     21.8G     20.0G  52% /etc/localtime
/ # ls  -ld  /etc/localtime
-rw-r--r--    1 root     root          1956 Oct  3 00:06 /etc/localtime
/ # date
Sat Dec 21 13:17:04 +03 2019
/ # strings  /etc/localtime
TZif2
EEST
TZif2
EEST
<+03>-3
/ #

I'm a IT Infrastructure and Operations Architect with extensive experience and administration skills and works for Turk Telekom. I provide hardware and software support for the IT Infrastructure and Operations tasks.

205 Total Posts
Follow Me

41 Comments

  1. kamagra store in ny kamagra 100mg kamagra oral jelly how to use video kamagra 100 mg kamagra oral jelly vs cialis

  2. kamagra oral jelly 100 mg wirkungsdauer kamagra online kamagra bestellen rotterdam kamagra online super kamagra forum hr kamagra 100mg chewable tablets Caf 031189d

  3. free adult webcam sites cam to cam sites best cam to cam site. camgirl camgirl sexy cam girl. web cam sites cam sites like chatroulette adult cam sites free.

  4. sexcams free sex cam to cam fire sex cam. free webcam girls cam model hairy cam girls. free gay webcam sites adultfreewebcamsites.com chat cam sites. webcam sex videos teen webcam sex asian hidden cam sex. top adult webcam sites adultfreewebcamsites best free sex cam sites. ebony live sex cam live free sex cam sex webcam.

  5. cam sex live bestonlinesexcams1.com online sex cam. young girls on cam nude cam girls sexy dance girl. asian cam girls camgirls1.com asian cam girls. free cam sites adultfreewebcamsites.com best live webcam sites. web cam girls camgirl websites top web cam girl. cam sex bestonlinesexcams1 random cam sex.

  6. young girls on cam nude cam girls cams girl. camming camgirls1.com hottest cam girl. asian cam sex bestonlinesexcams1 teen hidden cam sex. best cam to cam sites adult live cam sites best cam sites for couples. nude cam girls best cam girl websites sexy dance girl. free sex web cam hidden cam sex tapes pakistani hidden cam sex.

  7. camming japanese cam girls anal cam girls. live webcam sex bestonlinesexwebcams.com teen web cam sex. cam sex online bestonlinesexcams1.com sex webcam. cam sites free adult web cam sites dirty cam sites. nude cam sites adult webcam sites best chat cam sites. free webcam girls free cam girls cam girl orgasm.

  8. random sex cam bestonlinesexwebcams mobile cam sex. sex cam sites online webcam sex young sex cam. other ebony cam sites cam sites that work on android dirty cam sites. model porn camgirls1.com online webcam girls. my free cam site adultfreewebcamsites.com top porn cam sites. webcam girls lesbian cam girls chaturbate cam girls.

  9. webcam model hotcamgirls1.com cam girl websites. camgirl hotcamgirls1.com best webcam girls. adult free webcam sites adultcamsites1 chatterbait cam site. free webcam sex cam sex online sex cam chat room. sex cam site free cam 2 cam sites webcam sites reviews. best cam to cam sites adultfreewebcamsites cam site reviews.

  10. I don't know if it's just me or if everyone else encountering problems with your site. It looks like some of the text within your posts are running off the screen. Can someone else please provide feedback and let me know if this is happening to them too? This may be a issue with my browser because I've had this happen previously. Kudos P.S. If you have a minute, would love your feedback on my new website re-design. You can find it by searching for «royal cbd» — no sweat if you can’t. Keep up the good work!

  11. Its not my first time to go to see this web site, i am browsing this website dailly and obtain nice data from here daily. P.S. If you have a minute, would love your feedback on my new website re-design. You can find it by searching for «royal cbd» — no sweat if you can’t. Keep up the good work!

  12. Good way of telling, and good paragraph to get data concerning my presentation subject, which i am going to convey in college. P.S. If you have a minute, would love your feedback on my new website re-design. You can find it by searching for «royal cbd» — no sweat if you can’t. Keep up the good work!

  13. private free sex cams sexcams00.online free safe sex cams.

  14. Hi, here on the forum guys advised a cool Dating site, be sure to register - you will not REGRET it https://bit.ly/2E5M4mo

  15. Hi, here on the forum guys advised a cool Dating site, be sure to register - you will not REGRET it https://bit.ly/2RekhmH

  16. Hi, here on the forum guys advised a cool Dating site, be sure to register - you will not REGRET it https://bit.ly/32hIGxJ

  17. Most Internet marketers treat commenting primarily as a link building tactic (spamming, basically) and don’t really give it a fair shake as a real marketing tactic. But true comment marketing is about sharing meaningful opinions and thoughts in a forum of like-minded individuals in order to encourage interaction, make connections and earn exposure. 우리카지노

  18. Blog commenting not only gives people an idea of who you are and what you’re about, but also allows you to build a strong presence that can draw traffic and leads to your site for months and even years to come. If your goal is to get traffic, it’s critical to find blogs that offer a direct link to your website from your comment (instead of a link to your profile on that site). That can make a world of difference in the amount of referral traffic that you will receive. For example, good targets for a search marketing agency might include 카지노사이트

  19. If you’re focusing on comment marketing as a reputation and branding effort, you can place more importance on popularity and relevancy, and less importance on the ease of the click-through. Examples for a search company might include The obvious way to do this is to use an RSS reader. Personally, I like to use Hootsuite for this. I create a separate tab that houses my RSS feeds so I can glance at them whenever I check my other networks and leave a comment early on a new piece of content. 우리카지노

  20. We stumbled over here by a different website and thought I might check things out. I like what I see so now i'm following you. Look forward to looking over your web page for a second time.

  21. Приветствую! Нашел увлекательную новость на этом сайте: http://agentorange.ru : смех до слез приколы смотреть приколы Тайны затерянных лайнеров http://agentorange.ru/art-foto-interesnoe/4073-tayny-zateryannyh-laynerov.html Алисия Арден на пляже Алисия Арден на пляже http://agentorange.ru/art-foto-interesnoe/1388-avarii-fur-gruzovikov-noyabr-dekabr-2014.html

  22. Привет всем участникам! прикольный у вас сайт! Нашел прикольную базу кино: боевики 2019 зарубежные лучшие смотреть Тут: фильмы смотреть хорошем качестве мелодрама про любовь http://kinoflyhd.net/melodrama/ список 2020 Здесь: смотреть самые лучшие криминальные фильмы http://kinoflyhd.net/kriminal/ список 2019 Здесь: Новые подробности байопика о Стиве Джобсе смотреть онлайн бесплатно http://kinoflyhd.net/5161-novye-podrobnosti-bayopika-o-stive-dzhobse.html Здесь: http://kinoflyhd.net/13057-florida-floride-2015.html

  23. buy cialis overseas can i buy cialis in mexico can i buy cialis in canada where to buy cialis online forum buy generic cialis online uk buy cialis online prescription how to buy cialis over the counter buy cialis 5mg online buy cialis without a prescription teva's generic viagra buying viagra online buy viagra with paypal no teletrack payday loans direct lenders 100 approval top payday loans direct lender payday loans no teletrack 100 approval bad credit debt consolidation loans small installment loans for bad credit

  24. is generic viagra available in the usa? order generic viagra cheapest generic viagra prices.

  25. viagra pills generic american pharmacy generic viagra generic viagra pictures.

  26. buy cialis professional how can i buy cialis buy cialis on ebay how to buy cialis over the counter buy cialis online without script buy cialis in usa how to buy cialis from canada buy cialis online cheap best way to buy cialis why doesn't generic viagra work as well generic viagra without subscription walmart roman generic viagra payday loans near me no credit check payday loans virginia fast auto and payday loans bad credit student loans without cosigner student loans bad credit

  27. how much is generic viagra at roman generic viagra availability fda and generic viagra.

  28. buy real cialis online buy cialis online safely buy brand cialis buy cialis online united states can you buy cialis without a prescription buy cialis india buy cialis in usa buy cialis online usa where to buy generic cialis online pharmacy viagra no prescription cheapest generic viagra from india sildenafil 100mg generic viagra ez payday loans locations no credit payday loans payday loans online no credit check direct lender bad credit unsecured loans guaranteed approval payday loans with bad credit

  29. generic viagra from india review genericviagra2o generic viagra for $5.

  30. can i buy cialis in canada buy cialis uk buy cialis generic online cheap buy cialis without presc where can i buy cialis buy generic cialis online cheap buy cialis online mexico buy cialis no prescription buy cialis from canada generic viagra from india pharmacy marley drugs generic viagra cheap viagra online usa get out of payday loans online payday loans texas payday loans near me no bank account home loans for people with bad credit monthly installment loans for bad credit

  31. raymeds generic viagra news on generic viagra buy generic viagra in usa.

  32. generic viagra without a doctor prescription from canada genericviagra2o generic viagra super active sildenafil 100mg.

  33. buy cialis next day delivery buy cialis online without script buy cialis from india how to buy cialis online cialis buy online buy cialis online canadian pharmacy buy cialis 5mg how to buy cialis without a prescription where to buy cialis generic buy aruba viagra kroger generic viagra sildenafil citrate price how much will the generic viagra cost cash advance payday loans payday loans texas online payday loans tn bad credit loans online no credit check credit union personal loans bad credit

  34. safest generic viagra websites genericviagra2o.com is generic sildenafil as good as viagra.

  35. buy cialis 10mg buy discount cialis can you buy cialis over the counter at walmart can i buy cialis online buy cialis online cheap where can you buy cialis buy cialis online canada pharmacy buy cialis online buy cialis 20mg is generic viagra available in the united states wikipedia viagra order online generic viagra from europe local payday loans indian sky payday loans payday loans without checking account requirements debt consolidation loans with bad credit bad credit installment loans

  36. purple generic viagra work where to buy generic viagra online forum how much does generic viagra cost in cabo.

  37. cialis buy online usa buy cialis online safely buy cialis 10mg buy cialis online with paypal buy cialis online safely best place to buy cialis buy cialis generic best place to buy cialis buy cialis from mexico why does the military buy viagra viagra generic where to buy real generic viagra can you get 2 payday loans from different places guaranteed approval payday loans no telecheck best payday loans online same day loans for very bad credit unsecured loans for bad credit

  38. generic viagra side effects generic viagra for sale online in canada generic viagra price canada. buy generic cialis online cheap best place to buy cialis online forum buy cialis canada buy cialis usa buy cialis canadian how to buy cialis without prescription where can i buy viagra or cialis buy cialis online safely buy cialis 5mg generic viagra be available does generic viagra work safe place to order online rx for viagra good payday loans payday loans online bad credit online payday loans direct lender bad credit loans monthly payments direct lenders best loans for bad credit

  39. viagra generic informercials genericviagra2o viagra generic cost cvs. buy cialis online without prescription can you buy cialis over the counter? buy viagra and cialis online where to buy cialis online buy cialis online can you buy cialis without a prescription buy cialis on ebay best place to buy cialis online without script where to buy cialis online buy viagra no prescription online viagra online order generic viagra online how payday loans work 3 month payday loans cash payday loans short term loans for bad credit same day installment loans for self employed with bad credit

  40. cheapest cialis generic viagra perego generic viagra generic viagra fast delivery. buy cialis online no prescription cialis buy can i buy cialis over the counter buy cialis non prescription buy cialis online safely buy generic cialis no prescription buy real cialis do you need a prescription to buy cialis buy cialis online in usa teva generic viagra from us pharmacy viagra buy generic viagra vs sildenafil citrate bad credit payday loans guaranteed approval direct lenders tribal payday loans no credit check best payday loans no credit check bank loans with bad credit can you get student loans with bad credit

Leave a Reply