Quick Start with Minikube β
Get Lynq running on Minikube in under 5 minutes using automated scripts.
Multi-Node Example
As the most common use case for Lynq, this guide uses Multi-Node infrastructure (SaaS application with multiple customers/nodes) as an example. The pattern shown here can be adapted for any database-driven infrastructure automation scenario.
Overview β
This guide uses automated scripts to set up a complete local environment:
- Minikube cluster with cert-manager (automatically installed)
- Lynq deployed and running with webhooks enabled
- MySQL test database for node data
- Sample LynqHub and LynqForm
- Live node provisioning from database
Time required
Full setup typically completes in around 5 minutes.
cert-manager Included
cert-manager is automatically installed by the setup script. It's required for webhook validation and defaulting in all environments (including local development).
Prerequisites β
Required Tools β
| Tool | Version | Install on macOS | Install on Linux |
|---|---|---|---|
| Minikube | v1.28.0+ | brew install minikube | Installation Guide |
| kubectl | v1.28.0+ | brew install kubectl | Installation Guide |
| Docker (driver) | Latest | Docker Desktop | Docker Engine |
System Requirements β
- CPU: 1+ core
- Memory: 1+ GB RAM
- Disk: 5+ GB free space
Step-by-Step Setup β
Step 1: Setup Minikube Cluster β
Prepare Minikube Cluster
Bootstraps the base cluster with cert-manager and Lynq CRDs.
./scripts/setup-minikube.shThis step creates
- Minikube control plane + kubeconfig
- cert-manager v1.13.2
- Namespaces: lynq-system, lynq-test
- Lynq CRDs
Post-run checks (click to toggle)
Step 2: Deploy Lynq β
Deploy Lynq Operator
Builds the controller image and deploys it into lynq-system.
./scripts/deploy-to-minikube.shPrerequisites
- Step 1 complete: Minikube + cert-manager running
- kubectl context points to Minikube
This step creates
- Lynq controller-manager Deployment/Service
- Webhook configuration and TLS Secret (via cert-manager)
- Metrics and leader-election resources
Post-run checks (click to toggle)
Step 3: Deploy MySQL Test Database β
Seed MySQL Test Database
Installs a MySQL 8.0 instance with sample node rows inside lynq-test.
./scripts/deploy-mysql.shPrerequisites
- Step 2 complete: Lynq operator is running
- Namespace lynq-test exists (created during Step 1)
This step creates
- mysql Deployment/Service
- nodes database and node_configs table
- Three sample node rows
- Read-only user node_reader and Secret
Post-run checks (click to toggle)
Step 4: Deploy LynqHub β
Create LynqHub
Creates the LynqHub CR that syncs MySQL rows every 30 seconds.
./scripts/deploy-lynqhub.shPrerequisites
- Step 3 complete: MySQL endpoint is Ready
- mysql-credentials Secret exists
This step creates
- LynqHub CR (test-hub)
- Column and extraValue mappings
- Recurring sync loop
Post-run checks (click to toggle)
Step 5: Deploy LynqForm β
Apply LynqForm
Defines the blueprint (Deployment, Service, etc.) for each active node.
./scripts/deploy-lynqform.shPrerequisites
- Step 4 complete: test-hub reports Ready
- Permissions to create templates in the same namespace as the hub
This step creates
- LynqForm CR (test-template)
- Deployment/Service definitions
- Hub β Template linkage
Post-run checks (click to toggle)
π Success! You're Running Lynq
You now have:
- β Minikube cluster with cert-manager (for webhook TLS)
- β Lynq managing nodes with webhooks enabled
- β MySQL database with 3 node rows
- β 2 Active Nodes (acme-corp, beta-inc) fully provisioned
- β Live sync between database and Kubernetes
- β Admission validation catching errors at apply time
What Was Created? β
For each active node (acme-corp, beta-inc):
LynqNode CR: acme-corp-test-template
βββ Deployment: acme-corp-app
βββ Service: acme-corp-appVerify your setup:
# Check LynqNode CRs
kubectl get lynqnodes
# Check node resources
kubectl get deployments,services -l lynq.sh/node
# View operator logs
kubectl logs -n lynq-system -l control-plane=controller-manager -fReal-World Example β
Let's see the complete lifecycle of a node from database to Kubernetes.
Adding a Node β
Insert a new row into the database:
INSERT INTO node_configs (node_id, node_url, is_active, subscription_plan)
VALUES ('acme-corp', 'https://acme.example.com', 1, 'enterprise');What happens automatically:
Within 30 seconds (syncInterval), the operator creates:
# 1. LynqNode CR
kubectl get lynqnode acme-corp-test-template
# 2. Namespace (if configured)
kubectl get namespace acme-corp-namespace
# 3. Deployment
kubectl get deployment acme-corp-app
# 4. Service
kubectl get service acme-corp-app
# 5. Ingress (if configured)
kubectl get ingress acme-corp-ingressAll without writing any YAML files. The template defines the blueprint, the database row provides the variables.
Deactivating a Node β
Update the database:
UPDATE node_configs SET is_active = 0 WHERE node_id = 'acme-corp';What happens automatically:
Within 30 seconds:
- LynqNode CR is deleted
- All associated resources are cleaned up (based on
DeletionPolicy) - Namespace is removed (if created)
No manual kubectl delete commands needed. The database is your source of truth.
Explore the System β
Test Node Lifecycle β
1. Add a New Node β
Add a row to the database:
# Connect to MySQL
kubectl exec -it deployment/mysql -n lynq-test -- \
mysql -u root -p$(kubectl get secret mysql-root-password -n lynq-test -o jsonpath='{.data.password}' | base64 -d) nodes
# Insert new node
INSERT INTO node_configs (node_id, node_url, is_active, subscription_plan)
VALUES ('delta-co', 'https://delta.example.com', 1, 'enterprise');
exitWait 30 seconds (syncInterval), then verify:
kubectl get lynqnode delta-co-test-template
kubectl get deployment delta-co-app2. Deactivate a Node β
# Update database
kubectl exec -it deployment/mysql -n lynq-test -- \
mysql -u root -p$(kubectl get secret mysql-root-password -n lynq-test -o jsonpath='{.data.password}' | base64 -d) -e \
"UPDATE nodes.node_configs SET is_active = 0 WHERE node_id = 'acme-corp';"Wait 30 seconds, then verify resources are cleaned up:
kubectl get lynqnode acme-corp-test-template # Not found
kubectl get deployment acme-corp-app # Not found3. Modify Template β
Edit the template to add more resources:
kubectl edit lynqform test-templateChanges automatically apply to all nodes. Monitor reconciliation:
kubectl get lynqnodes --watchView Metrics β
# Port-forward metrics endpoint
kubectl port-forward -n lynq-system deployment/lynq-controller-manager 8080:8080
# View metrics
curl http://localhost:8080/metrics | grep lynqnode_Cleanup β
Option 1: Clean Resources Only β
Keep the cluster, remove operator and nodes:
kubectl delete lynqnodes --all
kubectl delete lynqform test-template
kubectl delete lynqhub test-hub
kubectl delete deployment,service,pvc mysql -n lynq-test
kubectl delete deployment lynq-controller-manager -n lynq-systemOption 2: Full Cleanup β
Delete everything including Minikube cluster:
./scripts/cleanup-minikube.shThis script interactively prompts for MySQL, operator, cluster, context, and image cache cleanup. Answer 'y' to all prompts for complete cleanup.
Troubleshooting β
Quick Diagnostics β
# Check operator status
kubectl get pods -n lynq-system
kubectl logs -n lynq-system -l control-plane=controller-manager
# Check hub sync
kubectl get lynqhub test-hub -o yaml
# Check node status
kubectl get lynqnode <lynqnode-name> -o yaml
# Check database connection
kubectl exec -it deployment/mysql -n lynq-test -- \
mysql -u node_reader -p$(kubectl get secret mysql-credentials -n lynq-test -o jsonpath='{.data.password}' | base64 -d) \
-e "SELECT * FROM nodes.node_configs;"Common issues:
- Operator not starting: Check cert-manager is ready (
kubectl get pods -n cert-manager) - Nodes not created: Verify MySQL is ready and
is_active = 1in database - Resources missing: Check LynqNode CR status and operator logs
Detailed Troubleshooting
For comprehensive troubleshooting, see Troubleshooting Guide.
Customizing Scripts β
All scripts support environment variables for customization:
# Example: Custom cluster configuration
MINIKUBE_CPUS=8 MINIKUBE_MEMORY=16384 ./scripts/setup-minikube.sh
# Example: Custom image tag
IMG=lynq:my-tag ./scripts/deploy-to-minikube.sh
# Example: Custom namespace
MYSQL_NAMESPACE=my-test-ns ./scripts/deploy-mysql.shRun any script with --help for full options.
What's Next? β
Now that you have Lynq running, explore these topics:
Concepts & Configuration β
- Templates Guide - Template syntax and 200+ functions
- Policies Guide - CreationPolicy, DeletionPolicy, ConflictPolicy, PatchStrategy
- DataSource Guide - MySQL configuration, VIEWs, and extraValueMappings
- Dependencies - Resource ordering with dependency graphs
Operations β
- Installation Guide - Deploy to production clusters
- Security Guide - RBAC and secrets management
- Performance Guide - Scaling and optimization
- Monitoring Guide - Prometheus metrics, alerts, and Grafana dashboards
Advanced Topics β
- Local Development - Development workflow and debugging
- Integration with External DNS - Automatic DNS per node
- Integration with Flux - GitOps-based deployment
Summary β
You've successfully:
- β Set up Minikube with Lynq in ~5 minutes
- β Deployed MySQL with sample node data
- β Created LynqHub and LynqForm
- β Provisioned nodes automatically from database
- β Tested node lifecycle (create, update, delete)
Next: Experiment with templates, policies, and template functions to build your database-driven platform!
Need Help? β
- π Documentation: See documentation site for detailed guides
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
