|
| 1 | +# 🚢 Deploying the MCP Gateway Stack with **Argo CD** |
| 2 | + |
| 3 | +This guide shows how to operate the **MCP Gateway Stack** with a *Git‑Ops* workflow powered by [Argo CD](https://argo-cd.readthedocs.io). Once wired up, every commit to the repository becomes an automatic deployment (or rollback) to your Kubernetes cluster. |
| 4 | + |
| 5 | +> 🌳 Git source of truth: |
| 6 | +> `https://github.com/IBM/mcp-context-forge` |
| 7 | +> |
| 8 | +> * **App manifests:** `k8s/` (Kustomize‑ready) |
| 9 | +> * **Helm chart (optional):** `charts/mcp-stack` |
| 10 | +
|
| 11 | +--- |
| 12 | + |
| 13 | +## 📋 Prerequisites |
| 14 | + |
| 15 | +| Requirement | Notes | |
| 16 | +| ----------------- | ---------------------------------------------------------------- | |
| 17 | +| Kubernetes ≥ 1.23 | Local (Minikube/kind) or managed (EKS, AKS, GKE, etc.) | |
| 18 | +| Argo CD ≥ 2.7 | Server & CLI (this guide installs server into the cluster) | |
| 19 | +| kubectl | Configured to talk to the target cluster | |
| 20 | +| Git access | The cluster must be able to pull the repo (public or deploy‑key) | |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## 🛠 Step 1 – Install Argo CD (once per cluster) |
| 25 | + |
| 26 | +```bash |
| 27 | +# Namespace + core components |
| 28 | +kubectl create namespace argocd |
| 29 | +kubectl apply -n argocd \ |
| 30 | + -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml |
| 31 | + |
| 32 | +# Wait for the server component |
| 33 | +kubectl -n argocd rollout status deploy/argocd-server |
| 34 | +``` |
| 35 | + |
| 36 | +### Install the CLI |
| 37 | + |
| 38 | +```bash |
| 39 | +# macOS |
| 40 | +brew install argocd |
| 41 | + |
| 42 | +# Linux (single‑binary) |
| 43 | +curl -sSL -o /tmp/argocd \ |
| 44 | + https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64 |
| 45 | +sudo install -m 555 /tmp/argocd /usr/local/bin/argocd |
| 46 | +``` |
| 47 | + |
| 48 | +Verify: |
| 49 | + |
| 50 | +```bash |
| 51 | +argocd version --client |
| 52 | +``` |
| 53 | + |
| 54 | +--- |
| 55 | + |
| 56 | +## 🔐 Step 2 – Initial Login |
| 57 | + |
| 58 | +Forward the API/UI to your workstation (leave running): |
| 59 | + |
| 60 | +```bash |
| 61 | +kubectl -n argocd port-forward svc/argocd-server 8083:443 |
| 62 | +``` |
| 63 | + |
| 64 | +Fetch the one‑time admin password and log in: |
| 65 | + |
| 66 | +```bash |
| 67 | +PASS="$(kubectl -n argocd get secret argocd-initial-admin-secret \ |
| 68 | + -o jsonpath='{.data.password}' | base64 -d)" |
| 69 | +argocd login localhost:8083 \ |
| 70 | + --username admin --password "$PASS" --insecure |
| 71 | +``` |
| 72 | + |
| 73 | +Open the web UI → [http://localhost:8083](http://localhost:8083) (credentials above). |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## 🚀 Step 3 – Bootstrap the Application |
| 78 | + |
| 79 | +Create an Argo CD *Application* that tracks the **`k8s/`** folder from the main branch: |
| 80 | + |
| 81 | +```bash |
| 82 | +APP=mcp-gateway |
| 83 | +REPO=https://github.com/IBM/mcp-context-forge.git |
| 84 | + |
| 85 | +argocd app create "$APP" \ |
| 86 | + --repo "$REPO" \ |
| 87 | + --path k8s \ |
| 88 | + --dest-server https://kubernetes.default.svc \ |
| 89 | + --dest-namespace default \ |
| 90 | + --sync-policy automated \ |
| 91 | + --revision main |
| 92 | +``` |
| 93 | + |
| 94 | +Trigger the first sync: |
| 95 | + |
| 96 | +```bash |
| 97 | +argocd app sync "$APP" |
| 98 | +``` |
| 99 | + |
| 100 | +Argo CD will apply all manifests and keep them in the *Synced* 🌿 / *Healthy* 💚 state. |
| 101 | + |
| 102 | +--- |
| 103 | + |
| 104 | +## ✅ Step 4 – Verify Deployment |
| 105 | + |
| 106 | +```bash |
| 107 | +kubectl get pods,svc,ingress |
| 108 | +argocd app list |
| 109 | +argocd app get mcp-gateway |
| 110 | +``` |
| 111 | + |
| 112 | +If using the sample Ingress: |
| 113 | + |
| 114 | +```bash |
| 115 | +curl http://gateway.local/health |
| 116 | +``` |
| 117 | + |
| 118 | +Otherwise, port‑forward: |
| 119 | + |
| 120 | +```bash |
| 121 | +kubectl port-forward svc/mcp-context-forge 8080:80 & |
| 122 | +curl http://localhost:8080/health |
| 123 | +``` |
| 124 | + |
| 125 | +--- |
| 126 | + |
| 127 | +## 🔄 Day‑2 Operations |
| 128 | + |
| 129 | +### Sync after a new commit |
| 130 | + |
| 131 | +```bash |
| 132 | +argocd app sync mcp-gateway |
| 133 | +``` |
| 134 | + |
| 135 | +### View diff before syncing |
| 136 | + |
| 137 | +```bash |
| 138 | +argocd app diff mcp-gateway |
| 139 | +``` |
| 140 | + |
| 141 | +### Roll back to a previous revision |
| 142 | + |
| 143 | +```bash |
| 144 | +argocd app history mcp-gateway |
| 145 | +argocd app rollback mcp-gateway <REVISION> |
| 146 | +``` |
| 147 | + |
| 148 | +### Disable / enable auto‑sync |
| 149 | + |
| 150 | +```bash |
| 151 | +# Pause auto‑sync |
| 152 | +a rgocd app set mcp-gateway --sync-policy none |
| 153 | +# Re‑enable |
| 154 | +argocd app set mcp-gateway --sync-policy automated |
| 155 | +``` |
| 156 | + |
| 157 | +--- |
| 158 | + |
| 159 | +## 🧹 Uninstall |
| 160 | + |
| 161 | +```bash |
| 162 | +# Delete the application (leaves cluster objects intact) |
| 163 | +argocd app delete mcp-gateway --yes |
| 164 | + |
| 165 | +# Remove Argo CD completely\ nkubectl delete ns argocd |
| 166 | +``` |
| 167 | + |
| 168 | +--- |
| 169 | + |
| 170 | +## 🧰 Makefile Shortcuts |
| 171 | + |
| 172 | +The repository ships with ready‑made targets: |
| 173 | + |
| 174 | +| Target | Action | |
| 175 | +| --------------------------- | ---------------------------------------------------------------------- | |
| 176 | +| `make argocd-install` | Installs Argo CD server into the current cluster | |
| 177 | +| `make argocd-forward` | Port‑forwards UI/API on [http://localhost:8083](http://localhost:8083) | |
| 178 | +| `make argocd-app-bootstrap` | Creates & auto‑syncs the *mcp‑gateway* application | |
| 179 | +| `make argocd-app-sync` | Forces a manual sync | |
| 180 | + |
| 181 | +Run `make help` to list them all. |
| 182 | + |
| 183 | +--- |
| 184 | + |
| 185 | +## 🧯 Troubleshooting |
| 186 | + |
| 187 | +| Symptom | Fix | |
| 188 | +| ------------------ | ------------------------------------------------------------------------------------------------- | |
| 189 | +| `ImagePullBackOff` | Check image name / pull secret & that the repo is public or credentials are configured in Argo CD | |
| 190 | +| `SyncFailed` | `argocd app logs mcp-gateway` for details; often due to immutable fields | |
| 191 | +| Web UI 404 | Ensure `argocd-forward` is still running, or expose via Ingress/LoadBalancer | |
| 192 | +| RBAC denied | Argo CD needs ClusterRoleBinding for non‑default namespaces – see docs | |
| 193 | + |
| 194 | +--- |
| 195 | + |
| 196 | +## 📚 Further Reading |
| 197 | + |
| 198 | +* Argo CD Docs – [https://argo-cd.readthedocs.io](https://argo-cd.readthedocs.io) |
| 199 | +* GitOps Pattern – [https://www.weave.works/technologies/gitops/](https://www.weave.works/technologies/gitops/) |
| 200 | +* Kustomize – [https://kubectl.docs.kubernetes.io/references/kustomize/](https://kubectl.docs.kubernetes.io/references/kustomize/) |
| 201 | +* Helm + Argo CD – [https://argo-cd.readthedocs.io/en/stable/user-guide/helm/](https://argo-cd.readthedocs.io/en/stable/user-guide/helm/) |
0 commit comments