store bcrypt hash in .env, pass to helm via --set at install time

This commit is contained in:
2026-06-14 18:10:39 +07:00
parent 73b35bfd14
commit 40d7f794aa
2 changed files with 20 additions and 11 deletions

View File

@@ -1 +1,2 @@
ARGOCD_ADMIN_PASSWORD= # Generate with: htpasswd -nbBC 10 "" YOUR_PASSWORD | tr -d ':\n' | sed 's/$2y/$2a/'
ARGOCD_ADMIN_PASSWORD_HASH=

View File

@@ -51,18 +51,22 @@ helm version
cp .env.example .env cp .env.example .env
``` ```
Edit `.env` and set `ARGOCD_ADMIN_PASSWORD` to your desired password. This file is gitignored — never commit it. Generate a bcrypt hash of your password and paste it into `.env`:
---
## Phase 3 — Install ArgoCD
Install `httpd-tools` for bcrypt hash generation (one-time):
```bash ```bash
sudo dnf install -y httpd-tools sudo dnf install -y httpd-tools
``` ```
```bash
htpasswd -nbBC 10 "" YOUR_PASSWORD | tr -d ':\n' | sed 's/$2y/$2a/'
```
Set `ARGOCD_ADMIN_PASSWORD_HASH` in `.env` to the output. This file is gitignored — never commit it.
---
## Phase 3 — Install ArgoCD
Add Helm repo: Add Helm repo:
```bash ```bash
@@ -73,10 +77,14 @@ helm repo add argo https://argoproj.github.io/argo-helm
helm repo update helm repo update
``` ```
Install ArgoCD with your password from `.env`: Install ArgoCD:
```bash ```bash
source .env && BCRYPT=$(htpasswd -nbBC 10 "" "$ARGOCD_ADMIN_PASSWORD" | tr -d ':\n' | sed 's/$2y/$2a/') && helm install argocd argo/argo-cd -n argocd --create-namespace -f manifests/argocd/values.yaml --set configs.secret.argocdServerAdminPassword="$BCRYPT" --set configs.secret.argocdServerAdminPasswordMtime="$(date -u +%Y-%m-%dT%H:%M:%SZ)" source .env
```
```bash
helm install argocd argo/argo-cd -n argocd --create-namespace -f manifests/argocd/values.yaml --set configs.secret.argocdServerAdminPassword="$ARGOCD_ADMIN_PASSWORD_HASH" --set configs.secret.argocdServerAdminPasswordMtime="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
``` ```
Wait for ArgoCD to be ready: Wait for ArgoCD to be ready:
@@ -91,7 +99,7 @@ Port-forward to access UI (MetalLB + Envoy not running yet):
kubectl port-forward svc/argocd-server -n argocd 8080:443 kubectl port-forward svc/argocd-server -n argocd 8080:443
``` ```
Open `https://localhost:8080` — login with `admin` and the password from your `.env`. Open `https://localhost:8080` — login with `admin` and the password you chose.
--- ---