This project provides a solution to deploy Socks Shop, an Open Source microservice based application on Kubernetes with a clear IaaC (Infrastructure as Code) approach implemented with terraform.
The following were provisioned using an infrastructure as Code approach
- Prometheus/Grafana as a monitoring tool
- EFK as a logging tool
- AWS as IaaS provider
- Let's Encrypt for SSL cert
- AWS Account
- AWS CLI configured
- Kubectl
- Terraform installed
- Domain Name
The structure below refers to the required files needed and to be understood before deploying.
- Socks Shop Manifests
deploy
┗ kubernetes
┃ ┗ manifests
┃ ┃ ┣ 00-sock-shop-ns.yaml
┃ ┃ ┣ 01-carts-dep.yaml
┃ ┃ ┣ 02-carts-svc.yml
┃ ┃ ┣ 03-carts-db-dep.yaml
┃ ┃ ┣ 04-carts-db-svc.yaml
┃ ┃ ┣ 05-catalogue-dep.yaml
┃ ┃ ┣ 06-catalogue-svc.yaml
┃ ┃ ┣ 07-catalogue-db-dep.yaml
┃ ┃ ┣ 08-catalogue-db-svc.yaml
┃ ┃ ┣ 09-front-end-dep.yaml
┃ ┃ ┣ 10-front-end-svc.yaml
┃ ┃ ┣ 11-orders-dep.yaml
┃ ┃ ┣ 12-orders-svc.yaml
┃ ┃ ┣ 13-orders-db-dep.yaml
┃ ┃ ┣ 14-orders-db-svc.yaml
┃ ┃ ┣ 15-payment-dep.yaml
┃ ┃ ┣ 16-payment-svc.yaml
┃ ┃ ┣ 17-queue-master-dep.yaml
┃ ┃ ┣ 18-queue-master-svc.yaml
┃ ┃ ┣ 19-rabbitmq-dep.yaml
┃ ┃ ┣ 20-rabbitmq-svc.yaml
┃ ┃ ┣ 21-session-db-dep.yaml
┃ ┃ ┣ 22-session-db-svc.yaml
┃ ┃ ┣ 23-shipping-dep.yaml
┃ ┃ ┣ 24-shipping-svc.yaml
┃ ┃ ┣ 25-user-dep.yaml
┃ ┃ ┣ 26-user-svc.yaml
┃ ┃ ┣ 27-user-db-dep.yaml
┃ ┃ ┗ 28-user-db-svc.yaml
The manifests for the microservice based architecture to be deployed.
- Terraform files used to provision the Socks Shop app.
tf-files
┣ domain.tf
┣ grafana.tf
┣ logging.tf
┣ main.tf
┣ nginx_ingress.tf
┣ output.tf
┣ prometheus.tf
┣ sock_shop.tf
┣ tls.tf
┗ var.tfTo deploy this project make the changes to the file with the neccesary details.
- Ingress.yaml file
files
┣ ingress.yaml
Edit the ingress.yaml block to your Domain name <domainname>
- hosts:
- microservice.<domainname>
secretName: acme-crt-prod
rules:
- host: microservice.<domainname>- Let's Encrypt file (cert-files)
cert-files
┣ prodcert.yaml
┗ prodissuer.yaml
Edit the blocks below in the file.
# Email address used for ACME registration in prodissuer.yaml
email: <enteremail>
# Edit <domainname> to Domain name
dnsNames:
- microservice.<domainname>- Deploy
cd tf-files
terraform apply -auto-approveThe terraform apply command provisions the EKS Cluster and the resources in the Task List will be deployed to the Cluster.
To access the Cluster and check the resources created.
aws eks --region $(terraform output -raw region) update-kubeconfig \
--name $(terraform output -raw cluster_name)In the directory below, route53 zone and record was created
tf-files
┣ domain.tfCopy the Hosted Zones from the AWS console to the Domain Registrar of your Domain Name immediately it is created.
Upon successful deployment the app can be visited with the URL in the browser.
https://microservice.<domainname>/
If you have any feedback, please reach out to me oluwafemimartins1234@gmail.com