Files
loc_az_hci/gitops/README.md
defiQUG c39465c2bd
Some checks failed
Test / test (push) Has been cancelled
Initial commit: loc_az_hci (smom-dbis-138 excluded via .gitignore)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 09:04:46 -08:00

123 lines
2.7 KiB
Markdown

# GitOps Configuration
This directory contains GitOps manifests for Flux to manage infrastructure and applications.
## Structure
```
gitops/
├── infrastructure/ # Base infrastructure (namespaces, RBAC, etc.)
└── apps/ # Application deployments
├── besu/
├── firefly/
├── chainlink/
├── blockscout/
├── cacti/
└── nginx-proxy/
```
## Setup Instructions
### Prerequisites
1. Gitea must be configured and accessible
2. Flux must be installed in the K3s cluster
3. Git repository must be created in Gitea
### Steps
1. **Create Git Repository in Gitea:**
- Access Gitea: http://192.168.1.121:3000
- Create new repository: `gitops`
- Initialize with README
2. **Push GitOps Manifests:**
```bash
git clone http://192.168.1.121:3000/hc-stack/gitops.git
cd gitops
# Copy manifests from this directory
git add .
git commit -m "Initial GitOps configuration"
git push
```
3. **Configure Flux GitRepository:**
```bash
ssh ubuntu@192.168.1.188
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
# Create GitRepository
sudo kubectl apply -f - <<EOF
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: GitRepository
metadata:
name: gitops-repo
namespace: flux-system
spec:
interval: 1m
url: http://192.168.1.121:3000/hc-stack/gitops.git
ref:
branch: main
EOF
```
4. **Create Kustomizations:**
```bash
# Infrastructure Kustomization
sudo kubectl apply -f - <<EOF
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: infrastructure
namespace: flux-system
spec:
interval: 5m
path: ./infrastructure
prune: true
sourceRef:
kind: GitRepository
name: gitops-repo
EOF
# Applications Kustomization
sudo kubectl apply -f - <<EOF
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: applications
namespace: flux-system
spec:
interval: 5m
path: ./apps
prune: true
sourceRef:
kind: GitRepository
name: gitops-repo
EOF
```
5. **Monitor Reconciliation:**
```bash
sudo kubectl get gitrepository -n flux-system
sudo kubectl get kustomization -n flux-system
sudo kubectl logs -n flux-system -l app=kustomize-controller -f
```
## Notes
- If Gitea requires authentication, create a secret:
```bash
sudo kubectl create secret generic gitops-repo-auth \
--from-literal=username=<username> \
--from-literal=password=<token> \
-n flux-system
```
Then update GitRepository to reference the secret:
```yaml
spec:
secretRef:
name: gitops-repo-auth
```