|
| 1 | +# ArgoCD Deployment (Terraform) |
| 2 | + |
| 3 | +This guide explains how to deploy **ArgoCD** with Keycloak OIDC integration using the Terraform configuration. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- **Terraform** >= 1.0 |
| 8 | +- **Kubernetes Cluster** (GKE, etc.) |
| 9 | +- **kubectl** configured to context |
| 10 | +- **Keycloak** instance running and accessible |
| 11 | +- **Ingress Controller** (e.g., NGINX) installed in cluster |
| 12 | +- **Cert-Manager** (optional but recommended for TLS) |
| 13 | + |
| 14 | +## Deployment Steps |
| 15 | + |
| 16 | +Make sure you've cloned the repository before running Terraform. |
| 17 | + |
| 18 | +```bash |
| 19 | +git clone https://github.com/Adorsys-gis/observability.git |
| 20 | +cd observability |
| 21 | +``` |
| 22 | + |
| 23 | +1. **Verify Context**: |
| 24 | + Ensure you are pointing to the correct cluster before running Terraform. |
| 25 | + ```bash |
| 26 | + kubectl config current-context |
| 27 | + ``` |
| 28 | + |
| 29 | +2. **Navigate to the directory**: |
| 30 | + From the project root: |
| 31 | + ```bash |
| 32 | + cd argocd/terraform |
| 33 | + ``` |
| 34 | + |
| 35 | +3. **Initialize Terraform**: |
| 36 | + ```bash |
| 37 | + terraform init |
| 38 | + ``` |
| 39 | + |
| 40 | +4. **Configure `terraform.tfvars`**: |
| 41 | + Copy the provided template: |
| 42 | + ```bash |
| 43 | + cp terraform.tfvars.template terraform.tfvars |
| 44 | + ``` |
| 45 | + Open `terraform.tfvars` and update the values to match your environment: |
| 46 | + |
| 47 | + ```hcl |
| 48 | + # Keycloak OIDC |
| 49 | + keycloak_url = "https://keycloak.example.com" |
| 50 | + keycloak_user = "admin" |
| 51 | + keycloak_password = "your-secure-password" |
| 52 | + target_realm = "argocd" |
| 53 | +
|
| 54 | + # ArgoCD Settings |
| 55 | + argocd_url = "https://argocd.example.com" |
| 56 | + kube_context = "gke_project_region_cluster" |
| 57 | + namespace = "argocd" |
| 58 | +
|
| 59 | + # Shared Infrastructure (set to false if managed elsewhere) |
| 60 | + install_cert_manager = false |
| 61 | + install_nginx_ingress = false |
| 62 | + |
| 63 | + # If using existing infrastructure, reference it |
| 64 | + nginx_ingress_namespace = "ingress-nginx" |
| 65 | + cert_manager_namespace = "cert-manager" |
| 66 | + letsencrypt_email = "admin@example.com" |
| 67 | + ``` |
| 68 | + |
| 69 | +5. **Review the Plan**: |
| 70 | + ```bash |
| 71 | + terraform plan |
| 72 | + ``` |
| 73 | + |
| 74 | +6. **Apply**: |
| 75 | + ```bash |
| 76 | + terraform apply |
| 77 | + ``` |
| 78 | + |
| 79 | +7. **Retrieve Admin Password**: |
| 80 | + After successful deployment: |
| 81 | + ```bash |
| 82 | + terraform output -raw argocd_admin_secret |
| 83 | + ``` |
| 84 | + |
| 85 | +## Post-Deployment |
| 86 | + |
| 87 | +### Access ArgoCD UI |
| 88 | + |
| 89 | +1. Navigate to your configured ArgoCD URL (e.g., `https://argocd.example.com`) |
| 90 | +2. Login with: |
| 91 | + - **Username**: `admin` |
| 92 | + - **Password**: Retrieved from terraform output above |
| 93 | +3. Or login via Keycloak SSO (if configured) |
| 94 | + |
| 95 | +### Configure Keycloak Groups (Optional) |
| 96 | + |
| 97 | +For RBAC via Keycloak groups: |
| 98 | + |
| 99 | +1. In Keycloak, create groups (e.g., `argocd-admins`, `argocd-developers`) |
| 100 | +2. Assign users to groups |
| 101 | +3. Groups will be automatically mapped to ArgoCD roles |
| 102 | + |
| 103 | +## Variables |
| 104 | + |
| 105 | +For detailed variable descriptions, see [variables.tf](../argocd/terraform/variables.tf). |
| 106 | + |
| 107 | +### Keycloak Configuration |
| 108 | + |
| 109 | +| Variable | Description | Default | |
| 110 | +|----------|-------------|---------| |
| 111 | +| `keycloak_url` | Keycloak server URL | **Required** | |
| 112 | +| `keycloak_user` | Keycloak admin username | **Required** | |
| 113 | +| `keycloak_password` | Keycloak admin password | **Required** | |
| 114 | +| `target_realm` | Keycloak realm for ArgoCD | `argocd` | |
| 115 | + |
| 116 | +### ArgoCD Configuration |
| 117 | + |
| 118 | +| Variable | Description | Default | |
| 119 | +|----------|-------------|---------| |
| 120 | +| `argocd_url` | ArgoCD public URL | **Required** | |
| 121 | +| `kube_context` | Kubernetes context name | `""` (uses current) | |
| 122 | +| `namespace` | ArgoCD namespace | `cert-manager` | |
| 123 | +| `letsencrypt_email` | Email for certificate notifications | **Required** | |
| 124 | + |
| 125 | +### Shared Infrastructure |
| 126 | + |
| 127 | +| Variable | Description | Default | |
| 128 | +|----------|-------------|---------| |
| 129 | +| `install_cert_manager` | Install Cert-Manager via Terraform | `false` | |
| 130 | +| `install_nginx_ingress` | Install NGINX Ingress via Terraform | `false` | |
| 131 | +| `cert_manager_version` | Cert-Manager chart version | `v1.15.0` | |
| 132 | +| `cert_manager_release_name` | Cert-Manager release name | `cert-manager` | |
| 133 | +| `cert_manager_namespace` | Cert-Manager namespace | `cert-manager` | |
| 134 | +| `cert_issuer_name` | Certificate issuer name | `letsencrypt-prod` | |
| 135 | +| `cert_issuer_kind` | Issuer type: `ClusterIssuer` or `Issuer` | `ClusterIssuer` | |
| 136 | +| `nginx_ingress_version` | NGINX Ingress chart version | `4.10.1` | |
| 137 | +| `nginx_ingress_release_name` | NGINX Ingress release name | `nginx-monitoring` | |
| 138 | +| `nginx_ingress_namespace` | NGINX Ingress namespace | `ingress-nginx` | |
| 139 | +| `ingress_class_name` | IngressClass name | `nginx` | |
| 140 | + |
| 141 | +## See Also |
| 142 | + |
| 143 | +- [Manual ArgoCD Deployment Guide](manual-argocd-deployment.md) |
| 144 | +- [Adopting Existing ArgoCD Installation](adopting-argocd.md) |
| 145 | +- [Troubleshooting ArgoCD](troubleshooting-argocd.md) |
0 commit comments