Development Example: Time Zone Service

Developed with
Calculated Systems


Course Intro
Integrating with GitHub and Google Cloud

The course is part of this learning path

Start course

This course explores how to build microservices in Go and deploy them on Kubernetes to create reusable components that can be fully managed in the cloud. We'll talk about what a microservice is and its overall architecture. We'll then take a look at the Go programming language, its benefits, and why it works well for building microservices.

You'll also get an intro to Kubernetes including what it is, what it is used for, and the key components that are needed to get a microservice from code to be exposed on the internet.

We'll then combine these three services to do an example use case where we'll build a microservice in Go and deploy it on Kubernetes. Finally, we'll look at CI/CD integration with GitHub and Google Cloud and how you can automate your deployments.

Learning Objectives

  • Learn about microservices and their overall architecture
  • Learn about the Go programming language and why it's good for building microservices
  • Understand how Kubernetes can be used to deploy microservices
  • Learn about CI/CD with GitHub and Google Cloud

Intended Audience

This course is intended for engineers throughout the tech stack or anyone who wants to get their feet wet in DevOps and learn how programs can be managed in the cloud.


There are no essential prerequisites for this course. However, we recommend that you have:

  • Experience with at least one high-level programming language, whether that be Java, Python, or Ruby
  • A conceptual understanding of Linux containers and/or Docker

Our development example will be a time zone service. In this example, we're going to get an overview of the project requirements, discuss the Go code that will achieve these requirements, utilize Docker to containerize the application, create a Kubernetes Cluster, make a deployment for our container and create a service to expose it to the internet.

Lastly, we'll test our application in the web browser to ensure it's working successfully. So what are we building? Your tech firm has clients all around the globe and time zones are starting to cause problems for your other services. They want you, the super developer that you are, to create a microservice that can get the time in any given time zone at an end point of slash time.

It will provide a JSON response of the time, and if applicable, any errors. It must be containerized and it will be managed with Kubernetes and have high availability. By default, the microservice will give the time in UTC and if a specific time zone is specified, display the correct time.

This diagram shows what the overall architecture might look like for your solution. At the very top, there is a load balancer that forwards traffic to a Kubernetes Service. This will provide a public IP address for you to use to test and access your microservice.

This load balancer is managed by Kubernetes inside your cluster. Within the cluster, you will have a deployment that manages a Pod. This Pod has one Container. This is the Docker code that we'll be discussing in the next section.

At a high level, this Go code starts a server on port 8,000, listening for the specific route of slash time. It accepts one query parameter, tz, and that can be any valid time zone within the IANA time zone database. It will then return a JSON response of the time within the specified time zone, or return the time in UTC.

If for some reason, the user gives an invalid time zone, the response will return nil, or null in JSON for the time and an error describing that they provided an unknown time zone. This solution does not depend on any external libraries. Everything is required. The JSON encoding, the web server, routing and time data are all provided by the Go standard library. All of this being written in less than 35 lines of code. If you're new to Go, I recommend trying to run this example on your local machine.

About the Author
Calculated Systems
Training Provider
Learning Paths

Calculated Systems was founded by experts in Hadoop, Google Cloud and AWS. Calculated Systems enables code-free capture, mapping and transformation of data in the cloud based on Apache NiFi, an open source project originally developed within the NSA. Calculated Systems accelerates time to market for new innovations while maintaining data integrity.  With cloud automation tools, deep industry expertise, and experience productionalizing workloads development cycles are cut down to a fraction of their normal time. The ability to quickly develop large scale data ingestion and processing  decreases the risk companies face in long development cycles. Calculated Systems is one of the industry leaders in Big Data transformation and education of these complex technologies.