Kybern Elite Certified
Samuel Akano

Samuel Akano

Cloud Native Engineer
Cloud Native Mastery - [Batch 1]
Capstone Case Study_

Expense Tracker — DevOps Portfolio Project

Infrastructure Architecture

Infrastructure Diagram
Technical Documentation_

Expense Tracker Application

Architecture, Technology Stack, Security, Availability, and Operational Design

1. Project Overview

The Expense Tracker is a cloud-native web application deployed on Amazon Web Services (AWS) using Amazon Elastic Kubernetes Service (Amazon EKS). The application uses React for the frontend, Node.js and Express.js for the backend, and MongoDB for data persistence.

The deployment incorporates Docker, Kubernetes, Terraform, GitHub Actions, Docker Hub, and Trivy. The observability stack consists of Prometheus, Grafana, Loki, and Grafana Alloy. AWS Application Load Balancer (ALB), AWS Certificate Manager (ACM), and Amazon Route 53 provide external access, TLS termination, and domain-name resolution.

The architecture separates the frontend, backend, and database into distinct components. Kubernetes manages application workloads, service discovery, replica counts, and horizontal scaling. Terraform supports infrastructure-as-code practices, while GitHub Actions automates application testing, container-image builds, vulnerability scanning, and deployment.

Project objectives

  • Deploy a containerised, multi-tier application on AWS.
  • Apply Kubernetes orchestration and service-discovery principles.
  • Implement application-layer scaling and pod-level resilience.
  • Automate application builds, vulnerability scanning, and deployment.
  • Provide centralised application metrics and log collection.
  • Apply infrastructure-as-code and version-control practices.
  • Demonstrate cloud networking, container security, monitoring, and operational troubleshooting.

2. System Architecture

2.1 High-level architecture

Architecture Diagram

The architecture comprises five logical areas:

  1. External access: Route 53, the ALB, and ACM provide domain resolution and HTTPS access.
  2. Application delivery: Kubernetes Ingress and Services route traffic to the frontend and backend.
  3. Data persistence: MongoDB stores application data using persistent storage.
  4. Continuous integration and deployment: GitHub Actions builds, scans, publishes, and deploys application images.
  5. Observability: Prometheus collects metrics, while Alloy forwards application logs to Loki for querying through Grafana.

The application runs in the expense-tracker Kubernetes namespace, while the monitoring stack runs in the monitoring namespace.

2.2 Three-tier application design

Presentation layer

The React frontend provides the user interface. NGINX serves the compiled frontend files and proxies API requests to the internal backend Service.

Application layer

The Node.js and Express.js backend handles application requests, business logic, and communication with MongoDB. The backend also exposes health endpoints and a Prometheus-compatible metrics endpoint.

Data layer

MongoDB stores application data independently of the frontend and backend workloads. A Kubernetes StatefulSet manages the database pod, and a PersistentVolumeClaim requests persistent storage.

The separation allows application components to be deployed and scaled independently. However, the database remains a shared dependency for all backend replicas.

3. Architectural Decisions

3.1 Amazon EKS for container orchestration

Amazon EKS provides a managed Kubernetes control plane and integration with AWS networking, identity, load balancing, and storage services.

EKS was selected to support:

  • Declarative workload management through Kubernetes manifests.
  • Deployment and replacement of application pods.
  • Internal service discovery.
  • Horizontal scaling of backend workloads.
  • Integration with AWS ALB Ingress.
  • Persistent storage through AWS-backed Kubernetes volumes.
  • Deployment of monitoring tools within the cluster.

The managed control plane reduces the need to administer Kubernetes control-plane components directly. The trade-off is increased infrastructure complexity and cost compared with a simpler single-server deployment.

3.2 Docker for application packaging

Docker packages application code and runtime dependencies into portable container images.

The frontend and backend use separate Dockerfiles, allowing independent builds and releases.

The frontend uses a multi-stage Docker build. Node.js compiles the React application, and NGINX serves the generated static files. The backend uses Node.js to execute the Express application and is configured to run as a non-root user.

This approach improves deployment consistency and separates the frontend runtime from the backend runtime.

3.3 Kubernetes Deployments and Services

Deployments manage the desired number of frontend and backend replicas. Services provide stable network endpoints for communication between workloads.

The application configuration specifies:

  • Three frontend replicas.
  • Three backend replicas.
  • A frontend Service on port 80.
  • A backend Service on port 4500.
  • A backend Horizontal Pod Autoscaler with a minimum of three and a maximum of six replicas.

This design supports application-layer scaling without requiring each pod to have a public endpoint.

3.4 StatefulSet for MongoDB

MongoDB runs as a single-replica StatefulSet using the mongo:7 image. The configuration includes a 1 GiB persistent-volume claim template using the gp2 storage class.

A StatefulSet provides stable pod identity and persistent-volume association, making it suitable for stateful workloads.

The single-replica configuration simplifies database operations and reduces the complexity of replication management. The trade-off is that the database remains a single point of failure.

3.5 AWS ALB and Kubernetes Ingress

An internet-facing AWS Application Load Balancer provides the public entry point. Kubernetes Ingress defines path-based routing rules for the application.

The public domain is expensetk.name.ng.

Request pathDestinationFunction
/Frontend ServiceServes the web interface
/apiBackend ServiceRoutes API requests
/grafanaGrafana proxy ServiceProvides access to the Grafana interface

ACM supplies the TLS certificate for HTTPS, and the Ingress configuration includes an HTTPS redirect.

This arrangement centralises external traffic routing and avoids requiring a separate public load balancer for every application Service.

3.6 Terraform for infrastructure as code

Terraform defines infrastructure through configuration files, allowing infrastructure changes to be version-controlled and managed through repeatable commands.

The Terraform configuration specifies an S3 backend with the following settings:

SettingConfiguration
State bucketexpense-tracker-terraform
State keyexpense-tracker-terraform/terraform.tfstate
AWS regionus-east-1
State encryptionEnabled
State lockingS3 lock file using use_lockfile=true

The S3 bucket must exist before Terraform initialises the remote backend.

Remote state supports collaboration and maintains a shared record of managed infrastructure. Access to the state bucket requires strict permissions because Terraform state may contain sensitive configuration values.

3.7 GitHub Actions for CI/CD

GitHub Actions automates application validation, image creation, vulnerability scanning, and deployment.

The workflow separates frontend and backend processing into distinct jobs. Application images are tagged using the first seven characters of the Git commit SHA, linking each published image to a source revision.

The deployment job updates Kubernetes image references and applies the relevant application resources to EKS.

Infrastructure provisioning and installation of the complete monitoring stack remain separate from the application CI/CD workflow.

4. Technology Stack and Responsibilities

TechnologyResponsibility
ReactFrontend user interface
Node.jsBackend runtime
Express.jsAPI and request handling
MongoDBApplication data storage
DockerContainer image creation
Amazon EKSManaged Kubernetes control plane
KubernetesWorkload orchestration and service discovery
TerraformInfrastructure as code
GitHubSource-code hosting and version control
GitHub ActionsContinuous integration and deployment
Docker HubContainer image registry
TrivyContainer image vulnerability scanning
AWS ALBPublic application entry point and traffic routing
AWS Certificate ManagerTLS certificate management
Amazon Route 53DNS resolution
Amazon EBSPersistent block storage
HelmKubernetes application and monitoring-stack management
NGINXFrontend web server and reverse proxy
PrometheusApplication metrics collection
GrafanaMetrics and log visualisation
LokiCentralised log storage and querying
Grafana AlloyKubernetes pod-log collection and forwarding
kubectlKubernetes administration
AWS CLIAWS administration and EKS access configuration

5. Networking and Traffic Flow

5.1 External traffic

A typical browser request follows this sequence:

  1. The browser requests https://expensetk.name.ng.
  2. Route 53 resolves the domain to the configured load-balancer endpoint.
  3. The ALB receives the HTTPS request.
  4. ACM provides the TLS certificate used by the HTTPS listener.
  5. Ingress routing directs the request to the appropriate Kubernetes Service.
  6. The Service forwards traffic to an available application pod.

5.2 Internal communication

The frontend NGINX configuration forwards API requests to:

backend-service.expense-tracker.svc.cluster.local:4500

The backend communicates with MongoDB through the mongo-service Kubernetes Service on port 27017.

Kubernetes DNS provides stable internal names even when individual pods are replaced. The Services are configured for internal cluster communication rather than direct public exposure.

5.3 Namespace organisation

The expense-tracker namespace contains the main application workloads. The monitoring namespace contains monitoring components, including Grafana, Prometheus, and Loki.

Namespace separation improves resource organisation and provides a scope for Kubernetes RBAC permissions. Namespaces alone do not isolate network traffic; NetworkPolicies and appropriate infrastructure-level controls provide additional restrictions.

6. Security Model

The security model covers public access, transport encryption, application containers, credentials, cloud identities, Kubernetes permissions, and monitoring access.

6.1 Transport security

HTTPS is configured at the ALB using an ACM certificate. The Ingress configuration includes a redirect from HTTP to HTTPS.

TLS protects browser-to-ALB traffic. Encryption between the ALB and backend targets depends on the configured target-group protocol. Internal HTTP traffic within the cluster is not automatically encrypted simply because public HTTPS is enabled.

6.2 Service exposure

The frontend, backend, and MongoDB Services use internal Kubernetes networking. The ALB Ingress provides controlled external access to the application and Grafana proxy.

MongoDB is accessed through its internal Service rather than a direct public database endpoint.

This reduces the public attack surface, although effective isolation also depends on AWS security groups, subnet routing, IAM permissions, and Kubernetes network controls.

6.3 Credential management

The MongoDB StatefulSet expects a Kubernetes Secret named mongo-secret, containing:

  • MONGO_INITDB_ROOT_USERNAME
  • MONGO_INITDB_ROOT_PASSWORD

The backend Deployment expects the MONGODB_URI environment variable.

Kubernetes Secrets separate sensitive values from ordinary application configuration. Their security depends on access permissions, encryption-at-rest configuration, cluster administration, and secret-handling practices.

Application credentials and registry passwords are not appropriate for public source-code repositories. Secret values must remain outside committed manifests and public documentation.

6.4 CI/CD credentials

The GitHub Actions workflow references the following repository or environment secrets:

  • DOCKER_USERNAME_EXPENSE
  • DOCKER_PASSWORD_EXPENSE
  • AWS_ACCESS_KEY_ID
  • SECRET_ACCESS_KEY

The values are supplied through GitHub's secret-management mechanism rather than hard-coded in the workflow.

The deployment identity requires permission to authenticate to AWS, access the target EKS cluster, and update the relevant Kubernetes resources. Least-privilege IAM policies reduce the potential impact of compromised credentials.

GitHub Actions OpenID Connect (OIDC) is an alternative to long-lived AWS access keys because OIDC can provide short-lived credentials through an appropriately configured IAM trust relationship.

6.5 Container security

Trivy scans frontend and backend container images for HIGH and CRITICAL vulnerabilities.

The backend Dockerfile creates a non-root user, reducing the privileges available to the application process.

Vulnerability scanning identifies known issues in image contents but does not guarantee complete security. Effective protection also depends on dependency maintenance, runtime configuration, access control, and remediation of identified vulnerabilities.

6.6 Kubernetes access control

Kubernetes RBAC controls which identities can access or modify cluster resources.

Grafana Alloy uses RBAC scoped to the expense-tracker namespace for pod-log discovery and collection. Restricting permissions to the required namespace reduces unnecessary access.

Cloud IAM, Kubernetes RBAC, node permissions, and CI/CD deployment privileges form separate but related parts of the access-control model.

6.7 Monitoring interface security

Grafana is accessible through /grafana using an NGINX proxy Service in the application namespace.

The public route provides convenient access to dashboards, but access control depends on Grafana authentication and the surrounding network configuration. Public exposure of monitoring interfaces can reveal operational information, so authentication and administrative permissions are important security controls.

7. Availability and Resilience Model

Availability depends on the frontend, backend, database, networking, storage, and supporting infrastructure. Multiple application replicas improve resilience at the application layer but do not eliminate failures in shared dependencies.

7.1 Frontend availability

The frontend Deployment specifies three replicas.

Kubernetes can replace failed pods and maintain the desired replica count when cluster capacity and scheduling are available. Multiple replicas reduce dependence on a single frontend pod.

They do not guarantee uninterrupted service during cluster-wide, networking, or load-balancer failures.

7.2 Backend availability and scaling

The backend Deployment specifies three replicas. The Horizontal Pod Autoscaler is configured with:

  • Minimum replicas: 3
  • Maximum replicas: 6
  • Target CPU utilisation: 70%

The HPA adjusts the desired number of backend replicas according to the configured CPU metric.

Scaling effectiveness depends on resource requests, metrics availability, available cluster capacity, and application behaviour. The CPU target is a scaling threshold rather than a guarantee of response time or throughput.

7.3 Health checks

The backend uses /health for startup and liveness probes and /ready for readiness checks. The frontend uses / for its probes.

These checks help Kubernetes determine whether a container has started, whether a process remains healthy, and whether a pod is ready to receive traffic.

Health probes improve recovery behaviour but only evaluate the conditions implemented by the corresponding endpoints.

7.4 Database availability

MongoDB uses a single-replica StatefulSet with persistent storage.

The persistent volume helps preserve database files across supported pod restarts and replacement scenarios. However, the architecture does not provide database replication or automatic database failover.

MongoDB remains a single point of failure. If the database process or its underlying storage becomes unavailable, database-dependent application operations may fail even when frontend and backend replicas remain healthy.

The current design prioritises simplicity and lower operational complexity over database redundancy.

7.5 Infrastructure availability

The ALB, Kubernetes cluster, worker nodes, DNS, networking, and persistent storage are additional dependencies.

Multi-replica application Deployments do not independently establish multi-AZ resilience. Availability across Availability Zones depends on subnet design, node distribution, pod placement, and the configuration of supporting AWS resources.

7.6 Availability summary

ComponentConfigurationAvailability implications
FrontendThree replicasReduces dependence on a single frontend pod
BackendThree replicas; HPA maximum of sixSupports scaling and application-pod recovery
MongoDBOne replica with persistent storageRemains a database single point of failure
ALB and IngressShared public entry pointCentralises traffic routing but remains a critical dependency
PrometheusIn-cluster metrics service and persistent storage configurationMonitoring availability depends on the running service and storage
GrafanaPersistent storage configuredDashboard access depends on the Grafana workload and supporting resources
LokiSingle-binary deployment, one replicaLog ingestion and querying have limited redundancy
Grafana AlloyOne configured replicaCollector unavailability can interrupt log collection

8. Monitoring and Logging Architecture

The observability stack provides metrics collection, log aggregation, and visualisation.

8.1 Prometheus

Prometheus scrapes backend metrics through the internal endpoint:

backend-service.expense-tracker.svc.cluster.local:4500/metrics

The configured scrape interval is 15 seconds. Prometheus server persistence is configured with an 8 GiB gp2 volume.

Metrics support investigation of application behaviour, performance changes, and resource usage, depending on the metrics exposed by the backend.

8.2 Grafana

Grafana provides dashboards for monitoring data sources such as Prometheus and Loki.

The Grafana proxy exposes the interface through the application's Ingress at /grafana. This allows browser access without directly exposing the Grafana ClusterIP Service.

8.3 Loki

Loki is configured as a single-binary deployment with filesystem-based storage, a replication factor of one, and a seven-day retention period.

The configuration requests a 5 GiB persistent volume. This supports centralised log storage but does not provide redundant log storage or a complete backup and recovery mechanism.

8.4 Grafana Alloy

Grafana Alloy discovers and collects pod logs in the expense-tracker namespace. The logs are forwarded to the Loki gateway in the monitoring namespace through the internal Kubernetes network.

This arrangement allows application logs to be queried centrally instead of relying exclusively on direct access to individual pods.

8.5 Observability limitations

The monitoring stack improves operational visibility but has limited redundancy. A single Alloy replica can interrupt log collection while unavailable, and a single Loki replica creates a failure point for log ingestion and access.

Persistent volumes support data retention across certain failures but do not replace backups. The configured seven-day Loki retention period defines the intended log-retention window.

9. CI/CD Pipeline

The GitHub Actions workflow automates application testing, container-image creation, vulnerability scanning, image publication, and Kubernetes deployment.

9.1 Pipeline stages

  1. Trigger: the workflow runs on pushes and pull requests targeting main.
  2. Backend validation: dependencies are installed with npm ci, followed by npm test.
  3. Frontend validation: dependencies are installed with npm ci, followed by npm run build.
  4. Container builds: separate Docker images are built for the frontend and backend.
  5. Security scanning: Trivy scans the images for HIGH and CRITICAL vulnerabilities.
  6. Image publication: push events publish images to Docker Hub using tags derived from the first seven characters of the Git commit SHA.
  7. Deployment: pushes to main trigger AWS/EKS authentication, update the image references, apply the relevant Kubernetes manifests, and wait for frontend and backend rollouts.

9.2 Image versioning

Commit-based image tags associate container images with specific source revisions. This improves traceability and supports identification of the application version deployed to the cluster.

Image digests provide a more precise identifier because tags can be reassigned. Digest-based deployment and recorded scan results can further strengthen release traceability.

9.3 Deployment scope

The pipeline applies application resources, including frontend and backend Deployments and Services, Ingress configuration, and the backend HPA.

The workflow does not provision the entire AWS infrastructure or independently install all database and monitoring components. Infrastructure provisioning and supporting-stack installation are separate operational processes.

10. Data Persistence and Recovery

MongoDB uses a StatefulSet with a persistent-volume claim template. The design separates database files from the lifecycle of an individual container.

Persistent storage helps retain database files during supported pod replacement and rescheduling events. However, persistent storage alone does not protect against every form of data loss.

The current architecture does not establish database replication or a complete disaster-recovery arrangement. Database recovery depends on the availability and integrity of the persistent volume and any separately maintained backups.

A comprehensive recovery strategy is defined through backup frequency, backup retention, encryption, recovery point objective (RPO), recovery time objective (RTO), and restoration testing.

11. Scalability and Performance

The frontend and backend can scale independently because each layer has its own Deployment and Service.

The backend HPA uses CPU utilisation to determine scaling requirements, with a configured minimum of three and maximum of six replicas. Kubernetes manages the desired replica count based on the configured metric.

Actual application capacity depends on available compute resources, application efficiency, database performance, network throughput, and cluster configuration.

Adding backend replicas increases the potential application-processing capacity but does not automatically increase MongoDB capacity. All backend replicas continue to depend on the same database instance.

The architecture demonstrates horizontal application scaling. Performance guarantees require measured results from workload and load testing.

12. Infrastructure and Cost Management

The project uses managed cloud infrastructure, container orchestration, and persistent storage. These services introduce ongoing costs that depend on resource configuration and usage.

Principal cost components include:

  • EKS cluster and worker-node charges.
  • Application Load Balancer charges and processed traffic.
  • NAT Gateway usage, where deployed.
  • EBS volumes used by database and monitoring components.
  • Data transfer and network usage.
  • Container registry storage and log storage.

Cost management involves understanding the lifecycle and billing implications of provisioned resources. Removing unused infrastructure can reduce costs, but deleting persistent volumes or Terraform state without a recovery plan can result in data loss or infrastructure-management problems.

13. Technical Limitations and Improvement Areas

The architecture has several defined limitations.

AreaCurrent limitationPotential improvement
DatabaseMongoDB runs as one replicaIntroduce an appropriate replication and failover strategy
Data recoveryPersistent storage does not constitute a backupImplement automated backups and restoration testing
Network securitySecurity depends on AWS and Kubernetes network configurationApply least-privilege traffic rules and appropriate network segmentation
IdentityCI/CD uses configured AWS credential secretsAdopt OIDC and least-privilege IAM policies
Secret managementKubernetes Secret protection depends on cluster configurationStrengthen encryption, access control, and credential rotation
MonitoringSeveral monitoring components have one replicaIntroduce redundancy according to availability requirements
AlertingMetrics and logs provide visibility but do not guarantee timely incident responseConfigure and test actionable alerts
Release safetyDeployment automation updates application workloadsImprove rollback controls and image-digest verification
PerformanceHPA configuration does not establish measured capacityConduct load testing and resource optimisation
Infrastructure reproducibilityTerraform and application deployment are separate workflowsMaintain complete infrastructure configuration and reproducible deployment instructions

These limitations represent engineering trade-offs and opportunities to strengthen resilience, security, and operational maturity.

14. Operational Commands

The following commands provide common methods for inspecting the deployed application.

Inspect application workloads and Services

bash
kubectl get deployments,pods,services -n expense-tracker

Inspect backend scaling

bash
kubectl get hpa -n expense-tracker
kubectl describe hpa -n expense-tracker

Inspect database and persistent storage

bash
kubectl get statefulset,pvc -n expense-tracker
kubectl get pods -n expense-tracker

Inspect external routing

bash
kubectl get ingress -n expense-tracker
kubectl describe ingress expense-ingress -n expense-tracker

Inspect monitoring workloads and storage

bash
kubectl get pods,services,pvc -n monitoring

Inspect worker-node Availability Zone placement

bash
kubectl get nodes -L topology.kubernetes.io/zone

These commands support investigation of deployment status, replica counts, scaling configuration, persistent storage, ingress routing, and cluster placement.

15. Conclusion

The Expense Tracker demonstrates a cloud-native DevOps architecture built around a containerised three-tier application deployed on Amazon EKS. Docker provides application packaging, Kubernetes manages workloads and internal networking, and Terraform supports infrastructure-as-code practices. GitHub Actions automates application validation, image creation, vulnerability scanning, and deployment.

The AWS ALB, ACM, and Route 53 provide the external access path, while Prometheus, Grafana, Loki, and Grafana Alloy support metrics collection, log aggregation, and visualisation.

Three frontend replicas, three backend replicas, and a CPU-based backend HPA provide application-layer scaling and resilience. MongoDB, however, runs as a single replica and remains a single point of failure. The monitoring stack also has limited redundancy, and persistent storage does not replace a backup and recovery strategy.

The architecture demonstrates practical experience with cloud infrastructure, containerisation, Kubernetes orchestration, CI/CD, security scanning, and observability. The documented trade-offs provide a clear basis for further improvements in database resilience, access control, recovery, monitoring, and operational reliability.

Candidate Profile

Graduation Date

10/20/2026

Training Intensity

16 Weeks / High Stakes

Verified Academy Milestones

Proof of technical competence verified by through graded weekly assignments and high-intensity Break-It lab solutions. Each milestone represents 10+ hours of deep engineering work.

M-LOG: 7

Assignment Week 7

passed

View Solution
M-LOG: 6

Assignment Week 6

passed

View Solution
M-LOG: 5

Assignment Week 5

passed

View Solution