This is a very basic example to deploy microservices. It consists of 4 services:
- A frontend asking for a password and showing the results from the other
services (
server
) - A password-checker that calculates the password strengths (
password-checker
) - A service that checks against a list of known passwords (
known-passwords
) - A service that uses a redis backend to check if the given password is in
the last 10 checked passwords (
password-dedup
).
You need docker, terraform and a kubernetes cluster.
-
Adapt
deployment/k8s.tf
and changeprovider "kubernetes" { config_path = "~/.kube/config" config_context = "docker-desktop" # <-- ADAPT HERE }
the value for
config_context
to your Kubernetes context. -
Run
terraform init
to initialize module and provider configuration. -
Run
terraform apply
and confirm withyes
. This will do the following:- Build the docker images
- Deploy the services and deployments to K8s
Navigate to your K8s installation. The frontend service is exposed on port 8000
.
For a local installation, head to [http://localhost:8000].
Run terraform destroy
to remove all resources from K8s and the images.
The setup can be tested without K8s using docker-compose up --build
from the main directory.