Skip to content

Commit f320214

Browse files
feat: enhance documentation with usage guide for private infra repo and update make targets reference
1 parent 3f12530 commit f320214

File tree

3 files changed

+465
-15
lines changed

3 files changed

+465
-15
lines changed

docs/getting-started.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
This guide walks you through provisioning a production-ready k3s cluster from two fresh VPS nodes.
44

5+
## Two ways to use k3s-lab
6+
7+
| Mode | When to use |
8+
|------|-------------|
9+
| **Direct** (this guide) | Evaluate the toolkit, test locally, or you don't need a private config repo |
10+
| **Infra repo** | Production use — private repo holds your `.env`, secrets, and custom apps; k3s-lab is fetched on-demand |
11+
12+
> For the infra repo pattern, see **[Using with a private infra repo](./using-with-infra.md)** once you've read this guide.
13+
14+
---
15+
516
## Prerequisites
617

718
### Local machine

docs/operations/make-targets.md

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ kubectl get nodes
4242
| `make deploy-dashboard-secret` | `DASHBOARD_PASSWORD` | Create the `traefik-dashboard-auth` BasicAuth secret in the `ingress` namespace. |
4343
| `make deploy-monitoring` | `GRAFANA_DOMAIN`, `GRAFANA_PASSWORD`, `KUBECONFIG_CONTEXT` | Deploy observability stack: kube-prometheus-stack, Loki, Promtail, Grafana IngressRoute. |
4444
| `make deploy-grafana-secret` | `GRAFANA_PASSWORD`, `KUBECONFIG_CONTEXT` | Create the `grafana-admin-secret` in the `monitoring` namespace (prerequisite for `make deploy-monitoring`). |
45-
| `make deploy-logging` || Re-run monitoring script (Loki + Promtail). |
4645

4746
---
4847

@@ -68,15 +67,36 @@ kubectl get nodes
6867

6968
## Testing
7069

71-
| Target | Description |
72-
| ----------- | -------------------------------------------------- |
73-
| `make test` | Run BATS unit tests (offline, no cluster required) |
70+
| Target | Description |
71+
| ------------------ | --------------------------------------------------------- |
72+
| `make test` | Run BATS unit tests (offline, no cluster required) |
73+
| `make test-watch` | Re-run tests on every file change (requires `entr`) |
74+
75+
---
76+
77+
## Dev tools
78+
79+
| Target | Description |
80+
| --------------------- | --------------------------------------------------------------------- |
81+
| `make lint` | Run `prek` linter on staged git changes |
82+
| `make lint-install` | Install `prek` via Homebrew (`brew install j178/tap/prek`) |
83+
| `make hooks-update` | Install / update git pre-commit hooks managed by `prek` |
84+
85+
---
86+
87+
## Provision (one-shot)
88+
89+
| Target | Description |
90+
| ---------------- | ------------------------------------------------------------------------------------------------- |
91+
| `make provision` | Full cluster lifecycle: VPS setup → k3s master → k3s worker → kubeconfig → deploy → monitoring |
92+
93+
This is equivalent to running all individual targets in order and is the recommended entry point for a fresh cluster.
7494

7595
---
7696

7797
## Lima VM (local testing)
7898

79-
Requires the [`infra`](https://github.com/KevinDeBenedetti/infra) parent repo, which embeds this repo as a submodule and adds Lima targets in `makefiles/99-lima.mk`.
99+
Lima targets are bundled directly in k3s-lab (`makefiles/99-lima.mk`) — no parent repo or submodule required.
80100

81101
| Target | Description |
82102
| ------------------------------- | ---------------------------------------------------------- |
@@ -128,18 +148,22 @@ make status
128148

129149
---
130150

131-
## Submodule usage
151+
## Using from a private infra repo
132152

133-
When this repo is embedded as a git submodule in a parent infra repo:
153+
k3s-lab can be consumed from a **private repo** containing only your personal configuration (`.env`, app manifests). No clone or submodule needed — makefiles are fetched on-demand via curl.
134154

135-
```makefile
136-
K3S_LAB := $(ROOT_DIR)/k3s-lab
155+
Set these variables in your consumer Makefile:
137156

138-
include $(K3S_LAB)/makefiles/30-k3s.mk
139-
include $(K3S_LAB)/makefiles/40-kubeconfig.mk
140-
include $(K3S_LAB)/makefiles/50-deploy.mk
141-
include $(K3S_LAB)/makefiles/60-status.mk
142-
include $(K3S_LAB)/makefiles/70-ssh.mk
157+
```makefile
158+
K3S_LAB := # empty → remote mode (curl from GitHub)
159+
K3S_LAB_RAW := https://raw.githubusercontent.com/KevinDeBenedetti/k3s-lab/main
143160
```
144161

145-
All targets resolve paths relative to `K3S_LAB` so they work correctly from any parent directory.
162+
All targets resolve scripts via `K3S_LAB_RAW` automatically.
163+
164+
| Target | Description |
165+
| ---------------- | --------------------------------------------------------------------- |
166+
| `make mk-update` | Force re-fetch all shared makefiles from k3s-lab into `.mk-cache/` |
167+
| `make mk-clean` | Remove `.mk-cache/` (files are re-fetched on the next `make` run) |
168+
169+
See the [Using with infra guide](../using-with-infra.md) for the complete step-by-step walkthrough.

0 commit comments

Comments
 (0)