Add ArgoCD and Gitea for GitOps workflow implementation
- Deploy ArgoCD with Helm for GitOps continuous delivery * Configure LoadBalancer and Ingress access on LAN * Enable ArgoCD Image Updater for automatic "latest" tag updates * Simplified RBAC for single-user homelab environment - Deploy Gitea as self-hosted Git server for local repositories * PostgreSQL backend with NFS persistent storage * SSH and HTTP access via MetalLB LoadBalancer * Integration guides for ArgoCD GitOps workflows - Add example ArgoCD Application with auto-image updates - Include comprehensive migration guides from Helm to GitOps - Maintain compatibility with existing Helm-based deployments 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,159 @@
|
||||
# Gitea + ArgoCD Setup Guide
|
||||
|
||||
## Gitea Access Information
|
||||
|
||||
**Web UI Access:**
|
||||
- **LoadBalancer URL**: http://192.168.222.27:3000
|
||||
- **Ingress URL**: http://gitea.turing.lan (add to your hosts file: `192.168.222.27 gitea.turing.lan`)
|
||||
- **SSH Clone URL**: `git@192.168.222.26:username/repo.git`
|
||||
|
||||
**Admin Credentials:**
|
||||
- **Username**: `admin`
|
||||
- **Password**: `gitea-admin-pass`
|
||||
- **Email**: `admin@turing.lan`
|
||||
|
||||
## Initial Gitea Setup
|
||||
|
||||
1. **Access Gitea**: Visit http://192.168.222.27:3000
|
||||
2. **Login**: Use admin credentials above
|
||||
3. **Create Organization**: Create an org for your homelab projects (e.g., "turingpi")
|
||||
4. **Create Repository**: Create your first repo for ArgoCD manifests
|
||||
|
||||
## Setting Up Your First Repository
|
||||
|
||||
### Create a Repository for ArgoCD Applications
|
||||
|
||||
1. **Create new repo**: `turingpi-argocd-apps`
|
||||
2. **Clone locally**:
|
||||
```bash
|
||||
git clone http://192.168.222.27:3000/admin/turingpi-argocd-apps.git
|
||||
cd turingpi-argocd-apps
|
||||
```
|
||||
|
||||
3. **Copy your existing values files**:
|
||||
```bash
|
||||
# Copy your existing values files to the repo
|
||||
cp /home/gilgamezh/code/turingpi/*_values.yaml ./helm-values/
|
||||
mkdir -p apps/
|
||||
```
|
||||
|
||||
4. **Create directory structure**:
|
||||
```
|
||||
turingpi-argocd-apps/
|
||||
├── apps/ # ArgoCD Application manifests
|
||||
├── helm-values/ # Your existing *_values.yaml files
|
||||
├── manifests/ # Raw Kubernetes manifests
|
||||
└── README.md
|
||||
```
|
||||
|
||||
## Migrating Plex to GitOps
|
||||
|
||||
### Step 1: Create ArgoCD Application
|
||||
|
||||
Create `apps/plex.yaml`:
|
||||
```yaml
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: plex
|
||||
namespace: argocd
|
||||
annotations:
|
||||
# Enable automatic image updates
|
||||
argocd-image-updater.argoproj.io/image-list: plex=ghcr.io/k8s-at-home/plex:latest
|
||||
argocd-image-updater.argoproj.io/plex.update-strategy: newest-build
|
||||
argocd-image-updater.argoproj.io/write-back-method: git
|
||||
spec:
|
||||
project: default
|
||||
source:
|
||||
repoURL: http://gitea-http.gitea.svc.cluster.local:3000/admin/turingpi-argocd-apps.git
|
||||
path: helm-values
|
||||
targetRevision: HEAD
|
||||
helm:
|
||||
valueFiles:
|
||||
- plex_values.yml
|
||||
destination:
|
||||
server: https://kubernetes.default.svc
|
||||
namespace: plex
|
||||
syncPolicy:
|
||||
automated:
|
||||
prune: true
|
||||
selfHeal: true
|
||||
syncOptions:
|
||||
- CreateNamespace=true
|
||||
```
|
||||
|
||||
### Step 2: Configure ArgoCD to Access Gitea
|
||||
|
||||
Add Gitea as a repository in ArgoCD:
|
||||
|
||||
1. **Via ArgoCD UI**:
|
||||
- Go to Settings → Repositories → Connect Repo
|
||||
- URL: `http://gitea-http.gitea.svc.cluster.local:3000/admin/turingpi-argocd-apps.git`
|
||||
- Username: `admin`
|
||||
- Password: `gitea-admin-pass`
|
||||
|
||||
2. **Via CLI**:
|
||||
```bash
|
||||
argocd repo add http://gitea-http.gitea.svc.cluster.local:3000/admin/turingpi-argocd-apps.git \
|
||||
--username admin --password gitea-admin-pass
|
||||
```
|
||||
|
||||
## Benefits of This Setup
|
||||
|
||||
✅ **Version Control**: All your configurations are in Git
|
||||
✅ **Automatic Updates**: Images update when "latest" tags change
|
||||
✅ **Audit Trail**: See what changed and when
|
||||
✅ **Easy Rollbacks**: Git history = deployment history
|
||||
✅ **Local Control**: No external dependencies
|
||||
✅ **Team Collaboration**: Others can contribute via Git
|
||||
|
||||
## Migration Strategy
|
||||
|
||||
1. **Start Small**: Migrate 1-2 applications first
|
||||
2. **Test Process**: Verify auto-updates work as expected
|
||||
3. **Bulk Migration**: Move remaining applications
|
||||
4. **Cleanup**: Remove manual Helm commands once confident
|
||||
|
||||
## Git Workflow Examples
|
||||
|
||||
### Adding a New Application
|
||||
```bash
|
||||
# Create new app manifest
|
||||
cat > apps/new-app.yaml << EOF
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: new-app
|
||||
namespace: argocd
|
||||
spec:
|
||||
# ... configuration
|
||||
EOF
|
||||
|
||||
# Commit and push
|
||||
git add apps/new-app.yaml
|
||||
git commit -m "Add new application: new-app"
|
||||
git push origin main
|
||||
```
|
||||
|
||||
### Updating Values
|
||||
```bash
|
||||
# Edit your values file
|
||||
vim helm-values/plex_values.yml
|
||||
|
||||
# Commit changes
|
||||
git add helm-values/plex_values.yml
|
||||
git commit -m "Update Plex CPU limits"
|
||||
git push origin main
|
||||
|
||||
# ArgoCD will auto-sync the changes
|
||||
```
|
||||
|
||||
Your homelab now has enterprise-grade GitOps capabilities while staying completely self-hosted! 🏠✨
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. **Access Gitea** and create your first repository
|
||||
2. **Copy your values files** to the new repo
|
||||
3. **Create your first ArgoCD application** pointing to Gitea
|
||||
4. **Test the workflow** with a simple change
|
||||
5. **Migrate more applications** gradually
|
||||
Reference in New Issue
Block a user