The Journey of a Microservice: From Source Code to a Full-Blown Kubernetes Deployment
Introduction
In this lecture, we’ll containerize and deploy a **REST **ful Go microservice to a Kubernetes cluster. We’ll also learn about some important building blocks of our cluster such as Deployment
s, Service
s, ConfigMap
s, Secret
s, Ingress
es, and the like.
Lecture
Deploying a Microservice to Kubernetes
Below, you’ll find the source code of the projects that we used in this video, links, resources, and other reference material for you learn and practice even further.
Read the Source
Below, you’ll find the zip archives of the projects and other related artifacts that we’ve covered in this article.
The Contents of the .netrc File
machine github.com
login your_github_username_comes_here
password ghp_your_github_api_key_comes_here
machine api.github.com
login your_github_username_comes_here
password ghp_your_github_api_key_comes_here
The Environment Variables
Here are the environment variables of interest that our builder script uses:
ECR_REPO=112233445566.dkr.ecr.us-west-2.amazonaws.com
ECR_IMAGE_FIZZ_CRYPTO=fizz-crypto
ECR_TAG_FIZZ_CRYPTO=0.0.15
ECR Login Script
Here’s the login script I used in the video:
aws ecr get-login-password --region us-west-2 | \
docker login --username AWS --password-stdin \
1122334455667788.dkr.ecr.us-west-2.amazonaws.com
Note
To use the above script, you need to install and configure AWS CLI first.
Resources and Additional Reading
Services We Used in the Video
Kubernetes
- Kuberetes
- Kubernetes Special Interest Groups (_SIG_s)
- Kubernetes: Performing a Rolling Update
- Configuring Access to Multiple Clusters
- Configuring Liveness, Readiness, and Startup Probes
Kubernetes API Objects That We Saw in the Video
Containers
- Containers
- Docker Engine Overview
- containerd Overview
- What is cri-o
- Managing Resources for Containers
- CRI: Container Runtime Interface
Container Images We Used
golang
Official Docker Imagenetshoot
: a Docker + Kubernetes network trouble-shooting swiss-army container
Building Images
Best Practices
GitHub Access Tokens
Linux
Playlist
▶ Deploying a Microservice to Kubernetes
Conclusion
That was how you can containerize and deploy a Go-based microservice to a Kubernetes cluster.
We’ll have more Go programming and Kubernetes deployments in the upcoming future.
Until next time… May the source be with you 🦄.