Skip to content

Make Targets Reference

Run make help to see all available targets with their descriptions.

bash
make help

k3s

TargetRequired varsDescription
make k3s-masterMASTER_IP, K3S_VERSIONInstall k3s server on the master node. Copies install-master.sh via SCP, runs it remotely, then saves K3S_NODE_TOKEN to .env.
make k3s-workerWORKER_IP, MASTER_IP, K3S_NODE_TOKENOpen master firewall for the worker, install k3s agent on the worker node.
make k3s-open-master-firewallWORKER_IP, MASTER_IPAdd UFW rules on the master to allow a new worker (VXLAN :8472/udp, kubelet :10250/tcp).
make k3s-uninstall-masterMASTER_IP⚠️ Remove k3s from the master node (destructive).
make k3s-uninstall-workerWORKER_IP⚠️ Remove k3s from the worker node (destructive).

Kubeconfig

TargetRequired varsDescription
make kubeconfigMASTER_IP, SSH_USER, KUBECONFIG_CONTEXTFetch /etc/rancher/k3s/k3s.yaml from the master, replace 127.0.0.1 with MASTER_IP, merge into ~/.kube/config as context KUBECONFIG_CONTEXT.

After running:

bash
kubectl config use-context k3s-lab
kubectl get nodes

Deployment

TargetRequired varsDescription
make deployDOMAIN, EMAIL, MASTER_IPDeploy base stack: namespaces, Traefik, cert-manager, ClusterIssuers, Traefik dashboard IngressRoute.
make deploy-dashboard-secretDASHBOARD_PASSWORDCreate the traefik-dashboard-auth BasicAuth secret in the ingress namespace.
make deploy-monitoringGRAFANA_DOMAIN, GRAFANA_PASSWORD, KUBECONFIG_CONTEXTDeploy observability stack: kube-prometheus-stack, Loki, Promtail, Grafana IngressRoute.
make deploy-grafana-secretGRAFANA_PASSWORD, KUBECONFIG_CONTEXTCreate the grafana-admin-secret in the monitoring namespace (prerequisite for make deploy-monitoring).
make deploy-loggingRe-run monitoring script (Loki + Promtail).

Status

TargetDescription
make nodesShow all cluster nodes with IPs and status (kubectl get nodes -o wide)
make statusShow all running pods across all namespaces
make podsShow pods with resource usage (kubectl top pods)

SSH shortcuts

TargetRequired varsDescription
make ssh-masterMASTER_IPOpen an interactive SSH shell on the master node
make ssh-workerWORKER_IPOpen an interactive SSH shell on the worker node
make known-hosts-resetRemove stale ~/.ssh/known_hosts entries for MASTER_IP and WORKER_IP (useful after VPS reformat)

Testing

TargetDescription
make testRun BATS unit tests (offline, no cluster required)

Lima VM (local testing)

Requires the infra parent repo, which embeds this repo as a submodule and adds Lima targets in makefiles/99-lima.mk.

TargetDescription
make vm-k3s-fullFull cycle: create VM → install k3s → kubeconfig → verify
make vm-k3s-createCreate Debian 12 VM (2 CPU, 4 GB RAM, 20 GB disk)
make vm-k3s-installRun k3s/install-master.sh inside the VM
make vm-k3s-kubeconfigMerge kubeconfig → context k3s-lima
make vm-k3s-testVerify cluster health (all 15 checks)
make vm-k3s-deployDeploy Traefik + cert-manager (mirrors production)
make vm-k3s-deploy-monitoringDeploy persistent Prometheus + Grafana + Loki + Promtail
make vm-k3s-smokeEphemeral TLS pipeline smoke test (cert-manager → Traefik)
make vm-k3s-smoke-monitoringEphemeral monitoring TLS smoke test
make vm-k3s-shellOpen interactive shell in the VM
make vm-k3s-stopStop VM (keep disk + state)
make vm-k3s-startStart a stopped VM
make vm-k3s-clean⚠️ Delete VM and free disk

See the Local Testing guide for the full step-by-step walkthrough.


Full workflow example

bash
# 1. Copy and configure environment
cp .env.example .env
# Edit .env with your VPS IPs, domain, etc.

# 2. Bootstrap k3s
make k3s-master            # Install control plane (~5 min)
make k3s-worker            # Join worker node (~3 min)

# 3. Configure kubectl
make kubeconfig
kubectl config use-context k3s-lab
make nodes                 # Verify both nodes are Ready

# 4. Deploy base stack (Traefik + cert-manager)
make deploy-dashboard-secret
make deploy                # ~3 min

# 5. Deploy monitoring (Prometheus + Grafana + Loki)
make deploy-grafana-secret
make deploy-monitoring     # ~10 min

# 6. Verify
make status

Submodule usage

When this repo is embedded as a git submodule in a parent infra repo:

makefile
K3S_LAB := $(ROOT_DIR)/k3s-lab

include $(K3S_LAB)/makefiles/30-k3s.mk
include $(K3S_LAB)/makefiles/40-kubeconfig.mk
include $(K3S_LAB)/makefiles/50-deploy.mk
include $(K3S_LAB)/makefiles/60-status.mk
include $(K3S_LAB)/makefiles/70-ssh.mk

All targets resolve paths relative to K3S_LAB so they work correctly from any parent directory.