71 lines
2.3 KiB
Makefile
71 lines
2.3 KiB
Makefile
# FleetDM Stack - Local Kubernetes Deployment
|
|
# Requires: helm, kubectl, docker; optional: kind or minikube
|
|
|
|
RELEASE_NAME ?= fleetdm-stack
|
|
NAMESPACE ?= fleetdm
|
|
CLUSTER_TYPE ?= kind
|
|
|
|
.PHONY: cluster install uninstall deps verify clean
|
|
|
|
cluster:
|
|
@echo "Creating local Kubernetes cluster ($(CLUSTER_TYPE))..."
|
|
ifeq ($(CLUSTER_TYPE),kind)
|
|
@command -v kind >/dev/null 2>&1 || { echo "Install kind: https://kind.sigs.k8s.io/"; exit 1; }
|
|
kind create cluster --name fleetdm --wait 2m || true
|
|
@echo "Installing nginx ingress controller..."
|
|
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
|
|
kubectl wait --namespace ingress-nginx --for=condition=ready pod -l app.kubernetes.io/component=controller --timeout=120s
|
|
else
|
|
@command -v minikube >/dev/null 2>&1 || { echo "Install minikube: https://minikube.sigs.k8s.io/"; exit 1; }
|
|
minikube start
|
|
minikube addons enable ingress
|
|
endif
|
|
@echo "Cluster ready. Run 'make install' to deploy FleetDM stack."
|
|
|
|
deps:
|
|
helm dependency update fleetdm-stack/
|
|
|
|
install: deps
|
|
@echo "Creating namespace $(NAMESPACE)..."
|
|
kubectl create namespace $(NAMESPACE) --dry-run=client -o yaml | kubectl apply -f -
|
|
@echo "Installing FleetDM stack..."
|
|
helm upgrade --install $(RELEASE_NAME) fleetdm-stack/ \
|
|
--namespace $(NAMESPACE) \
|
|
--wait --timeout 15m
|
|
@echo "Installation complete. Run 'make verify' to check status."
|
|
|
|
uninstall:
|
|
@echo "Removing FleetDM stack..."
|
|
helm uninstall $(RELEASE_NAME) --namespace $(NAMESPACE) || true
|
|
kubectl delete namespace $(NAMESPACE) --timeout=120s || true
|
|
@echo "Uninstall complete."
|
|
|
|
verify:
|
|
@echo "Verifying FleetDM, MySQL, and Redis..."
|
|
@echo ""
|
|
@echo "=== Pods ==="
|
|
kubectl get pods -n $(NAMESPACE) -o wide
|
|
@echo ""
|
|
@echo "=== Services ==="
|
|
kubectl get svc -n $(NAMESPACE)
|
|
@echo ""
|
|
@echo "=== Ingress ==="
|
|
kubectl get ingress -n $(NAMESPACE)
|
|
@echo ""
|
|
@echo "Access Fleet UI:"
|
|
ifeq ($(CLUSTER_TYPE),kind)
|
|
@echo " Add to /etc/hosts: 127.0.0.1 fleet.localhost"
|
|
@echo " Then: curl -H 'Host: fleet.localhost' http://localhost"
|
|
else
|
|
@echo " minikube tunnel (if needed) then: http://fleet.localhost (add to /etc/hosts)"
|
|
endif
|
|
|
|
clean: uninstall
|
|
ifeq ($(CLUSTER_TYPE),kind)
|
|
@echo "Deleting Kind cluster..."
|
|
kind delete cluster --name fleetdm || true
|
|
else
|
|
@echo "Stopping minikube..."
|
|
-minikube stop
|
|
endif
|