- Application: Node.js app running on port 3000, containerized with Docker.
- Infrastructure: Managed with Terraform, including EKS cluster, IAM roles, and supporting AWS resources.
- Kubernetes: Helm chart for deployment, service, ingress, and secret management.
- Secrets Management: Uses External Secrets Operator to sync AWS Secrets Manager secrets into Kubernetes.
- Monitoring & Alerting: Prometheus and Alertmanager (Helm values in
infrastructure/Helm-values/1-alert-manager.yaml), with Slack integration for alerts. - CI/CD: GitHub Actions pipeline for build, push to ECR, and deployment to EKS.
app/Dockerfile: Node.js app containerization.server.js,package.json: Application code.helm-chart/: Helm chart for Kubernetes deployment.templates/: Deployment, Service, Ingress, etc.values.yaml,values-dev.yaml: Helm values for different environments.
infrastructure/*.tf: Terraform code for AWS infrastructure.Helm-values/: Monitoring/alerting Helm values.
.github/workflows/deploy-to-eks.yaml: CI/CD pipeline.◊
- AWS account with admin access
- AWS CLI, kubectl, Helm, Terraform, Docker installed
- GitHub repository secrets for AWS credentials
git clone <your-fork-url>
cd DevOps-Take-HomeBefore running Terraform, configure your AWS credentials. You can do this in one of the following ways:
- Using environment variables:
export AWS_ACCESS_KEY_ID=your-access-key-id export AWS_SECRET_ACCESS_KEY=your-secret-access-key export AWS_DEFAULT_REGION=us-east-1
- Or using the AWS CLI profile:
aws configure # Follow the prompts to set your credentials and region
Then run:
cd infrastructure
terraform init
terraform apply- This will create EKS, IAM roles, and other AWS resources.
Before running the CI/CD pipeline, configure the following in your GitHub repository:
-
Add repository secrets:
AWS_ACCESS_KEY_ID: Your AWS access key IDAWS_SECRET_ACCESS_KEY: Your AWS secret access key
-
Add a repository variable:
Account_ID: Your AWS account ID (e.g., 123456789012)
Go to your GitHub repo → Settings → Secrets and variables → Actions to add these.
These are required for authenticating to AWS and tagging/pushing the Docker image to ECR.
The CI/CD pipeline (GitHub Actions) will:
- Build the Docker image from
app/Dockerfile - Push to ECR (repo auto-created if missing)
- Deploy to EKS using Helm
You can also do this manually:
cd app
docker build -t <account-id>.dkr.ecr.<region>.amazonaws.com/hello-world-js:<tag> .
# Authenticate and push to ECRcd app/helm-chart
helm upgrade --install hello-world-js . \
--set image.repository=<account-id>.dkr.ecr.<region>.amazonaws.com/hello-world-js \
--set image.tag=<tag> \
--values values-dev.yaml- For the demo app to work, you must create a secret in AWS Secrets Manager named:
demo-project/rds-creds- This secret must contain a key called
passwordwith your desired value.
- The External Secrets Operator will sync this secret into Kubernetes (see
values-dev.yamlunderexternalSecrets).
- Prometheus & Alertmanager: Deployed via Helm (see
infrastructure/Helm-values/1-alert-manager.yaml). - Dashboards: Access via the Prometheus/Alertmanager web UIs.
- To access Grafana (if deployed), run:
kubectl port-forward svc/grafana 3000:80 -n monitoring # Then open http://localhost:3000 in your browser - To check CPU usage for a pod:
kubectl top pod -n <namespace> # Or for all pods: kubectl top pods --all-namespaces
- To access Grafana (if deployed), run:
- Alerting: Alerts are sent to Slack (
#oncall-devopschannel, webhook configured in Alertmanager values).
- App Health: Liveness/readiness probes on
/at port 3000 (seevalues-dev.yaml). - Kubernetes:
kubectl get pods,kubectl get svc,kubectl get ingress - Monitoring: Prometheus/Alertmanager dashboards
- CI/CD: GitHub Actions workflow status
- Fork and Clone the Repo
- Set up AWS credentials in GitHub repository secrets:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY
- Provision Infrastructure with Terraform as above.
- Update
values-dev.yaml:- Change all occurrences of the AWS account ID (e.g., in IAM role ARNs, domains, and annotations) to match your new AWS account.
- Update the ECR repository, domain, and any other account-specific values as needed.
- Update the
clusterIssuersection:name: (optional) Name for the ClusterIssuer resource.email: Your email for Let's Encrypt notifications.privateKeySecretName: (optional) Name for the secret storing the ACME account key.region: AWS region for Route53 DNS01 challenge.hostedZoneID: Your Route53 Hosted Zone ID for the domain you want to secure.
- Push code to main branch to trigger CI/CD, or deploy manually with Helm.
- Set up AWS Secrets Manager with required secrets.
- Access the app via the ALB DNS or your configured domain.
- Infrastructure code:
infrastructure/*.tf - CI/CD config:
.github/workflows/deploy-to-eks.yaml - Dockerfile:
app/Dockerfile - Kubernetes manifests:
app/helm-chart/templates/ - Monitoring/alerting:
infrastructure/Helm-values/1-alert-manager.yaml
