135 lines
2.9 KiB
Markdown
135 lines
2.9 KiB
Markdown
|
|
# Docker Hub Quick Start Guide
|
||
|
|
|
||
|
|
## 🚀 Quick Setup (3 Steps)
|
||
|
|
|
||
|
|
### 1. Create Docker Hub Secrets
|
||
|
|
|
||
|
|
```bash
|
||
|
|
./infrastructure/kubernetes/setup-dockerhub-secrets.sh
|
||
|
|
```
|
||
|
|
|
||
|
|
This creates the `dockerhub-creds` secret in all namespaces with your Docker Hub credentials.
|
||
|
|
|
||
|
|
### 2. Apply Updated Manifests
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Development environment
|
||
|
|
kubectl apply -k infrastructure/kubernetes/overlays/dev
|
||
|
|
|
||
|
|
# Production environment
|
||
|
|
kubectl apply -k infrastructure/kubernetes/overlays/prod
|
||
|
|
```
|
||
|
|
|
||
|
|
### 3. Verify Pods Are Running
|
||
|
|
|
||
|
|
```bash
|
||
|
|
kubectl get pods -n bakery-ia
|
||
|
|
```
|
||
|
|
|
||
|
|
All pods should now be able to pull images from Docker Hub!
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 🔧 What Was Configured
|
||
|
|
|
||
|
|
✅ **Docker Hub Credentials**
|
||
|
|
- Username: `uals`
|
||
|
|
- Access Token: `dckr_pat_zzEY5Q58x1S0puraIoKEtbpue3A`
|
||
|
|
- Email: `ualfaro@gmail.com`
|
||
|
|
|
||
|
|
✅ **Kubernetes Secrets**
|
||
|
|
- Created in: `bakery-ia`, `bakery-ia-dev`, `bakery-ia-prod`, `default`
|
||
|
|
- Secret name: `dockerhub-creds`
|
||
|
|
|
||
|
|
✅ **Manifests Updated (47 files)**
|
||
|
|
- All service deployments
|
||
|
|
- All database deployments
|
||
|
|
- All migration jobs
|
||
|
|
- All cronjobs and standalone jobs
|
||
|
|
|
||
|
|
✅ **Tiltfile Configuration**
|
||
|
|
- Supports both local registry and Docker Hub
|
||
|
|
- Use `export USE_DOCKERHUB=true` to enable Docker Hub mode
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 📖 Full Documentation
|
||
|
|
|
||
|
|
See [docs/DOCKERHUB_SETUP.md](docs/DOCKERHUB_SETUP.md) for:
|
||
|
|
- Detailed configuration steps
|
||
|
|
- Troubleshooting guide
|
||
|
|
- Security best practices
|
||
|
|
- Image management
|
||
|
|
- Rate limits information
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 🔄 Using with Tilt (Local Development)
|
||
|
|
|
||
|
|
**Default: Local Registry**
|
||
|
|
```bash
|
||
|
|
tilt up
|
||
|
|
```
|
||
|
|
|
||
|
|
**Docker Hub Mode**
|
||
|
|
```bash
|
||
|
|
export USE_DOCKERHUB=true
|
||
|
|
export DOCKERHUB_USERNAME=uals
|
||
|
|
docker login -u uals
|
||
|
|
tilt up
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 🐳 Pushing Images to Docker Hub
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Login first
|
||
|
|
docker login -u uals
|
||
|
|
|
||
|
|
# Use the automated script
|
||
|
|
./scripts/tag-and-push-images.sh
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## ⚠️ Troubleshooting
|
||
|
|
|
||
|
|
**Problem: ImagePullBackOff**
|
||
|
|
```bash
|
||
|
|
# Check if secret exists
|
||
|
|
kubectl get secret dockerhub-creds -n bakery-ia
|
||
|
|
|
||
|
|
# Recreate secret if needed
|
||
|
|
./infrastructure/kubernetes/setup-dockerhub-secrets.sh
|
||
|
|
```
|
||
|
|
|
||
|
|
**Problem: Pods not using new credentials**
|
||
|
|
```bash
|
||
|
|
# Restart deployment
|
||
|
|
kubectl rollout restart deployment/<deployment-name> -n bakery-ia
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 📝 Scripts Reference
|
||
|
|
|
||
|
|
| Script | Purpose |
|
||
|
|
|--------|---------|
|
||
|
|
| `infrastructure/kubernetes/setup-dockerhub-secrets.sh` | Create Docker Hub secrets in all namespaces |
|
||
|
|
| `infrastructure/kubernetes/add-image-pull-secrets.sh` | Add imagePullSecrets to manifests (already done) |
|
||
|
|
| `scripts/tag-and-push-images.sh` | Tag and push all custom images to Docker Hub |
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## ✅ Verification Checklist
|
||
|
|
|
||
|
|
- [ ] Docker Hub secret created: `kubectl get secret dockerhub-creds -n bakery-ia`
|
||
|
|
- [ ] Manifests applied: `kubectl apply -k infrastructure/kubernetes/overlays/dev`
|
||
|
|
- [ ] Pods running: `kubectl get pods -n bakery-ia`
|
||
|
|
- [ ] No ImagePullBackOff errors: `kubectl get events -n bakery-ia`
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
**Need help?** See the full documentation at [docs/DOCKERHUB_SETUP.md](docs/DOCKERHUB_SETUP.md)
|