Kubernetes infrastructure for the Notes Cloud platform.
Install the following tools:
| Tool | macOS | Windows |
|---|---|---|
| Docker | brew install --cask docker |
Docker Desktop |
| kubectl | brew install kubectl |
choco install kubernetes-cli |
| k3d | brew install k3d |
choco install k3d |
./setup.sh.\setup.ps1This will:
- Create a k3d cluster called
notes-cloud-cluster - Deploy PostgreSQL database
- Run database migrations
- Deploy all microservices
┌─────────────────────────────────────────────────────────────────┐
│ notes-cloud-cluster (k3d) │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │auth-service │ │notes-service│ │ todo-service│ │
│ │ :8081 │ │ :8082 │ │ :8085 │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
│ │
│ ┌──────────────┐ ┌─────────────────┐ │
│ │sharing-service│ │reminder-service │ │
│ │ :8083 │ │ :8084 │ │
│ └──────────────┘ └─────────────────┘ │
│ │
│ ┌─────────────────────────────────────┐ │
│ │ PostgreSQL │ │
│ │ :5432 │ │
│ └─────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
| Service | Port | Description |
|---|---|---|
| auth-service | 8081 | Authentication and authorization |
| notes-service | 8082 | Notes management |
| sharing-service | 8083 | Note sharing functionality |
| reminder-service | 8084 | Reminders and notifications |
| todo-service | 8085 | Todo lists management |
| postgres | 5432 | PostgreSQL database |
kubectl get pods -n notes-cloud
kubectl get svc -n notes-cloud# Port forward to access a service
kubectl port-forward -n notes-cloud svc/auth-service 8081:8081
# Then call the service
curl http://localhost:8081/authService/api/v1/healthzkubectl logs -n notes-cloud -l app=auth-service -fkubectl rollout restart deployment auth-service -n notes-cloudk3d cluster delete notes-cloud-clusterEdit your code locally.
# Login to Docker Hub (first time only)
docker login
# Build and push
docker build -t hristo12319/notes-cloud-auth-service:latest .
docker push hristo12319/notes-cloud-auth-service:latestkubectl rollout restart deployment auth-service -n notes-cloudkubectl get pods -n notes-cloud -l app=auth-service
kubectl logs -n notes-cloud -l app=auth-service -fAll images are hosted on Docker Hub under hristo12319/:
| Image | Repository |
|---|---|
| auth-service | hristo12319/notes-cloud-auth-service |
| notes-service | hristo12319/notes-cloud-notes-service |
| todo-service | hristo12319/notes-cloud-todo-service |
| sharing-service | hristo12319/notes-cloud-sharing-service |
| reminder-service | hristo12319/notes-cloud-reminder-service |
| migrations | hristo12319/notes-cloud-migrations |
The image doesn't exist on Docker Hub. Build and push it:
docker build -t hristo12319/notes-cloud-<service>:latest .
docker push hristo12319/notes-cloud-<service>:latest
kubectl rollout restart deployment <service> -n notes-cloudCheck the logs:
kubectl logs -n notes-cloud -l app=<service> --previousCheck if PostgreSQL is running:
kubectl get pods -n notes-cloud -l app=postgres
kubectl logs -n notes-cloud -l app=postgresk3d cluster delete notes-cloud-cluster
./setup.sh # or .\setup.ps1 on Windowsnotes-cloud-infrastructure/
├── k8s/
│ ├── namespace.yaml
│ ├── postgres/
│ │ ├── postgres-config-map.yaml
│ │ ├── postgres-secrets.yaml
│ │ ├── postgres-stateful-set.yaml
│ │ ├── postgres-cluster-ip.yaml
│ │ └── postgres-headless-service.yaml
│ ├── migrations/
│ │ ├── config-map.yaml
│ │ └── job.yaml
│ ├── auth-service/
│ │ ├── auth-service-deployment.yaml
│ │ ├── auth-service-cluster-ip.yaml
│ │ ├── auth-service-config-map.yaml
│ │ └── auth-service-secret.yaml
│ ├── notes-service/
│ ├── todo-service/
│ ├── sharing-service/
│ └── reminder-service/
├── setup.sh # Linux/macOS setup script
├── setup.ps1 # Windows setup script
└── README.md