This boilerplate provides a complete setup for deploying a Python Flask application on Kubernetes using Argo CD for GitOps on AWS.
k8s-python-argocd/
├── app/
│ └── app.py # Python Flask application
├── manifests/ # Kubernetes manifests
│ ├── namespace.yaml
│ ├── deployment.yaml
│ ├── service.yaml
│ ├── ingress.yaml
│ ├── serviceaccount.yaml
│ └── secret.yaml
├── argocd/ # Argo CD configurations
│ ├── application.yaml
│ └── project.yaml
├── Dockerfile
├── requirements.txt
├── aws-iam-policy.json
└── README.md
- EKS cluster running on AWS
- Argo CD installed on the cluster
- AWS Load Balancer Controller installed
- ECR repository for container images
- Proper IAM roles and policies
# Build the Docker image
docker build -t python-app .
# Tag for ECR
docker tag python-app:latest YOUR_ACCOUNT.dkr.ecr.us-west-2.amazonaws.com/python-app:latest
# Push to ECR
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin YOUR_ACCOUNT.dkr.ecr.us-west-2.amazonaws.com
docker push YOUR_ACCOUNT.dkr.ecr.us-west-2.amazonaws.com/python-app:latest
# Create IAM policy
aws iam create-policy \
--policy-name python-app-policy \
--policy-document file://aws-iam-policy.json
# Create IAM role for service account
eksctl create iamserviceaccount \
--name python-app-sa \
--namespace python-app \
--cluster YOUR_CLUSTER_NAME \
--attach-policy-arn arn:aws:iam::YOUR_ACCOUNT:policy/python-app-policy \
--approve
- Update
argocd/application.yaml
with your Git repository URL - Update
manifests/deployment.yaml
with your ECR image URL - Update
manifests/serviceaccount.yaml
with your AWS account ID - Update
manifests/secret.yaml
with actual base64 encoded AWS credentials (or use AWS IAM roles)
# Apply Argo CD project
kubectl apply -f argocd/project.yaml
# Apply Argo CD application
kubectl apply -f argocd/application.yaml
- Flask Application: Simple Python web app with health checks and AWS integration
- Kubernetes Manifests: Complete set of K8s resources including deployment, service, ingress
- Argo CD GitOps: Automated deployment with sync policies
- AWS Integration: IAM roles, ECR, ALB ingress controller
- Security: Service accounts, RBAC, secrets management
- Health Checks: Liveness and readiness probes
/
- Root endpoint with app info/health
- Health check endpoint/aws-info
- AWS connectivity test
- Modify
app/app.py
for your application logic - Update
manifests/deployment.yaml
for scaling and resource requirements - Adjust
argocd/application.yaml
for sync policies and source configuration - Modify
aws-iam-policy.json
for required AWS permissions