Minimal, production-ready Kubernetes platform with automated CI/CD pipeline.
- AWS CLI installed and configured with appropriate permissions
- Terraform >= 1.0 installed
- kubectl installed
- Docker installed and running
Required Environment Variables:
Before working with this repository, you must export your AWS credentials:
export AWS_ACCESS_KEY_ID="your-access-key-id"
export AWS_SECRET_ACCESS_KEY="your-secret-access-key"
export AWS_REGION="eu-west-3" # or your preferred regionImportant: These environment variables must be set in your current shell session. You can verify they are set with:
echo $AWS_ACCESS_KEY_ID
echo $AWS_SECRET_ACCESS_KEY
echo $AWS_REGIONRequired AWS Permissions: Your AWS user/role needs permissions for:
- EKS (Elastic Kubernetes Service)
- ECR (Elastic Container Registry)
- VPC and networking
- IAM roles and policies
- S3 (for Terraform state)
- DynamoDB (for Terraform state locking)
- Infrastructure: AWS EKS cluster with VPC using Terraform modules
- Application: Go HTTPS server containerized and deployed to EKS
- CI/CD: GitHub Actions pipeline for automated deployment
- State Management: Terraform state stored in AWS S3 with DynamoDB locking
First, create the S3 backend and DynamoDB table:
cd terraform-backend
terraform init
terraform apply
cd ..make bootstrapThis single command will:
- Initialize and apply Terraform infrastructure
- Configure kubectl for EKS
- Deploy the application
# 1. Deploy infrastructure
make init
make plan
make apply
# 2. Deploy application
make deploymake help # Show all available commands
make bootstrap # Complete setup and deployment
make deploy # Deploy application to Kubernetes
make status # Show cluster and app status
make test # Test application locally
make test-k8s # Test application in Kubernetes
make logs # Show application logs
make clean # Clean up local resourcesaws configure
# Enter your AWS Access Key ID, Secret Access Key, and region (eu-west-3)Your AWS user/role needs permissions for:
- EKS (Elastic Kubernetes Service)
- ECR (Elastic Container Registry)
- VPC and networking
- IAM roles and policies
- S3 (for Terraform state)
- DynamoDB (for Terraform state locking)
cd terraform-backend
terraform init
terraform plan
terraform apply
cd ..This creates:
- S3 bucket:
k8s-platform-terraform-state - DynamoDB table:
terraform-state-lock
make init
make plan
make applyExpected Output:
- VPC with public/private subnets
- EKS cluster with managed node group
- ECR repository for container images
- IAM roles and policies
make deployThis will:
- Configure kubectl for EKS
- Deploy all Kubernetes manifests
- Wait for deployment rollout
make statusmake test-k8smake logsAdd these secrets to your GitHub repository:
- AWS_ACCESS_KEY_ID: Your AWS access key
- AWS_SECRET_ACCESS_KEY: Your AWS secret key
- AWS_REGION:
eu-west-3 - ECR_REPOSITORY_URI: Output from
terraform output ecr_repository_url
- Go to your GitHub repository
- Click Settings → Secrets and variables → Actions
- Click New repository secret
- Add each secret with the exact names above
- Push changes to the
mainbranch - GitHub Actions will automatically:
- Build the Docker image
- Push to ECR
- Deploy to EKS
- Run smoke tests
- Go to Actions tab in GitHub
- Click on the latest workflow run
- Monitor each step for success/failure
-
Terraform Backend Error
# Ensure backend is properly configured cd terraform-backend && terraform apply cd .. && cd terraform && terraform init -reconfigure
-
EKS Connection Issues
# Update kubeconfig make setup-kubectl # Check cluster status aws eks describe-cluster --name k8s-platform --region eu-west-3
-
Image Pull Errors
# Check ECR repository aws ecr describe-repositories --region eu-west-3 # Verify image exists aws ecr describe-images --repository-name jd-test-server --region eu-west-3
-
Pod Issues
# Check pod logs make logs # Describe pod for events kubectl describe pod <pod-name>
make destroycd terraform-backend
terraform destroy
cd ..Warning: This will delete the S3 bucket and DynamoDB table, potentially losing Terraform state if not backed up elsewhere.
- Monitoring: Add Prometheus and Grafana
- Logging: Implement centralized logging with ELK stack
- Security: Enable pod security policies and network policies
- Backup: Implement EKS cluster backup strategy
- Multi-region: Extend to multiple AWS regions