Skip to Content
Lynq

Quick Start

Run Lynq on a local kind cluster with a small MySQL table, then change rows and watch each customer's Deployment and Service appear and go. About 10 minutes; every output on this page is real.

You will run the customer-web example: a MySQL table with one row per customer, and a LynqForm that gives every active customer a Deployment and a Service. Then you change rows and watch the cluster follow.

Every output block on this page was printed by these exact commands, run by website/scripts/capture/capture.sh.

No cluster? Try it in your browser

The Killercoda scenario runs a similar flow in a disposable cluster, with nothing to install.

Prerequisites

ToolInstall
DockerDocker Desktop, OrbStack, or Docker Engine
kindbrew install kind or kind.sigs.k8s.io
kubectlbrew install kubectl or kubernetes.io
Helmbrew install helm or helm.sh

Create a cluster and install Lynq

Lynq's admission webhooks get their TLS certificates from cert-manager, so it goes first.

kind create cluster --name lynq

kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.0/cert-manager.yaml
kubectl wait --for=condition=Available --timeout=300s -n cert-manager deployment --all

helm repo add lynq https://k8s-lynq.github.io/lynq
helm install lynq lynq/lynq -n lynq-system --create-namespace --set namespace.create=false --wait

namespace.create=false stops the chart from rendering its own Namespace on top of the one --create-namespace makes. Without it, a fresh install fails with namespaces "lynq-system" already exists.

Start a database with three customers

Get the example files:

git clone --depth 1 https://github.com/k8s-lynq/lynq
cd lynq/examples/customer-web

rows.sql is the table. acme and gamma are active; beta is not.

examples/customer-web/rows.sql
-- One row per customer. Every active row gets its own stack.
CREATE TABLE customers (
  id      VARCHAR(63) PRIMARY KEY,
  active  BOOLEAN NOT NULL DEFAULT TRUE,
  image   VARCHAR(255) NOT NULL DEFAULT 'nginx:1.27',
  plan    VARCHAR(32) NOT NULL DEFAULT 'basic'
);

INSERT INTO customers (id, active, image, plan) VALUES
  ('acme',  TRUE,  'nginx:1.27', 'pro'),
  ('beta',  FALSE, 'nginx:1.27', 'basic'),
  ('gamma', TRUE,  'nginx:1.27', 'basic');

Load it into a throwaway MySQL:

kubectl create namespace lynq-demo
kubectl create configmap customers-sql -n lynq-demo --from-file=rows.sql
kubectl apply -f mysql.yaml
kubectl rollout status deployment/mysql -n lynq-demo

Point Lynq at the table

The LynqHub says where the rows are and which columns are the id and the active flag:

examples/customer-web/lynqhub.yaml
# Reads the customers table every 30 seconds.
apiVersion: operator.lynq.sh/v1
kind: LynqHub
metadata:
  name: customers
spec:
  source:
    type: mysql
    syncInterval: 30s
    mysql:
      host: mysql.lynq-demo.svc
      port: 3306
      database: lynq_demo
      username: lynq_reader
      passwordRef:
        name: mysql-credentials
        key: password
      table: customers
  valueMappings:
    uid: id
    activate: active
  extraValueMappings:
    image: image
    plan: plan

The LynqForm says what every active row gets:

examples/customer-web/lynqform.yaml
# What to create for every active customer row.
apiVersion: operator.lynq.sh/v1
kind: LynqForm
metadata:
  name: web
spec:
  hubId: customers
  deployments:
    - id: app
      nameTemplate: "{{ .uid }}-web"
      spec:
        apiVersion: apps/v1
        kind: Deployment
        spec:
          replicas: 1
          selector:
            matchLabels: { app: "{{ .uid }}-web" }
          template:
            metadata:
              labels: { app: "{{ .uid }}-web", plan: "{{ .plan }}" }
            spec:
              containers:
                - name: web
                  image: "{{ .image }}"
                  ports: [{ containerPort: 80 }]
  services:
    - id: svc
      nameTemplate: "{{ .uid }}-web"
      dependIds: [app]
      spec:
        apiVersion: v1
        kind: Service
        spec:
          selector: { app: "{{ .uid }}-web" }
          ports: [{ port: 80, targetPort: 80 }]

Apply both in a namespace of their own, with the password the hub reads:

kubectl create namespace customers
kubectl create secret generic mysql-credentials -n customers --from-literal=password=lynq-demo-password
kubectl apply -n customers -f lynqhub.yaml -f lynqform.yaml

See what Lynq created

Within one sync (30 seconds here), there is a LynqNode for each active row:

Terminal
$ kubectl get lynqhubs,lynqforms,lynqnodes -n customers
NAME                                 TEMPLATES   DESIRED   READY   FAILED   CONDITIONS          AGE
lynqhub.operator.lynq.sh/customers   1           2         2                DatabaseConnected   33s

NAME                            HUB         TOTAL   READY   ROLLOUT   UPDATING   APPLIED   AGE
lynqform.operator.lynq.sh/web   customers   2       2                            True      33s

NAME                                  UID     FORM   READY   DESIRED   SKIPPED   CONFLICTED   CONDITIONS   AGE
lynqnode.operator.lynq.sh/acme-web    acme    web    2       2                   False        Reconciled   33s
lynqnode.operator.lynq.sh/gamma-web   gamma   web    2       2                   False        Reconciled   33s

Real output: Lynq 1.1.23 on Kubernetes v1.34.0, captured by website/scripts/capture/capture.sh

Each LynqNode applied its Deployment and Service. beta is inactive, so it has none:

Terminal
$ kubectl get deployments,services -n customers
NAME                        READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/acme-web    1/1     1            1           33s
deployment.apps/gamma-web   1/1     1            1           33s

NAME                TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
service/acme-web    ClusterIP   10.96.210.99   <none>        80/TCP    24s
service/gamma-web   ClusterIP   10.96.25.79    <none>        80/TCP    23s

Real output: Lynq 1.1.23 on Kubernetes v1.34.0, captured by website/scripts/capture/capture.sh

A LynqNode's status says what it applied and whether it is Ready:

Terminal
$ kubectl describe lynqnode acme-web -n customers
…
Status:
  Applied Resources:
    Deployment/customers/acme-web@app
    Service/customers/acme-web@svc
  Conditions:
    Last Transition Time:  2026-11-30T05:27:18Z
    Message:               Reconciliation completed
    Reason:                ReconcileComplete
    Status:                False
    Type:                  Progressing
    Last Transition Time:  2026-11-30T05:27:27Z
    Message:               Successfully reconciled all resources
    Reason:                Reconciled
    Status:                True
    Type:                  Ready
    Last Transition Time:  2026-11-30T05:27:18Z
    Message:               No resource conflicts detected
    Reason:                NoConflict
    Status:                False
    Type:                  Conflicted
    Last Transition Time:  2026-11-30T05:27:27Z
    Message:               All resources are healthy
    Reason:                Healthy
    Status:                False
    Type:                  Degraded
  Desired Resources:       2
  Last Full Reconcile At:  2026-11-30T05:27:18Z
  Observed Generation:     1
  Ready Resources:         2
Events:
  Type    Reason                     Age                From                 Message
  ----    ------                     ----               ----                 -------
  Normal  TemplateAppliedSuccess     33s                lynqnode-controller  Successfully applied LynqForm 'web' (generation: 1). All 2 resources reconciled successfully (1 changed, 0 ready). Hub: customers, LynqNode UID: acme, Namespace: customers. All resources are now in desired state.
  Normal  TemplateResourcesApplying  24s (x2 over 33s)  lynqnode-controller  Applying resources from LynqForm 'web' (generation: 1). Reconciling 2 total resources: 1 Deployment(s), 1 Service(s). Hub: customers, LynqNode UID: acme, Namespace: customers. Resources will be applied in dependency order with readiness checks.
  Normal  TemplateAppliedSuccess     24s                lynqnode-controller  Successfully applied LynqForm 'web' (generation: 1). All 2 resources reconciled successfully (1 changed, 2 ready). Hub: customers, LynqNode UID: acme, Namespace: customers. All resources are now in desired state.

Real output: Lynq 1.1.23 on Kubernetes v1.34.0, captured by website/scripts/capture/capture.sh

Change the table

Turn beta on:

kubectl exec -n lynq-demo deploy/mysql -- \
  mysql -uroot -plynq-demo-password -vvv lynq_demo \
  -e "UPDATE customers SET active = TRUE WHERE id = 'beta';"
Terminal
--------------
UPDATE customers SET active = TRUE WHERE id = 'beta'
--------------

Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

Bye

Real output: Lynq 1.1.23 on Kubernetes v1.34.0, captured by website/scripts/capture/capture.sh

On the next sync, beta-web appears:

Terminal
$ kubectl get lynqnodes -n customers
NAME        UID     FORM   READY   DESIRED   SKIPPED   CONFLICTED   CONDITIONS   AGE
acme-web    acme    web    2       2                   False        Reconciled   63s
beta-web    beta    web    2       2                   False        Reconciled   3s
gamma-web   gamma   web    2       2                   False        Reconciled   63s

Real output: Lynq 1.1.23 on Kubernetes v1.34.0, captured by website/scripts/capture/capture.sh

Now turn acme off:

kubectl exec -n lynq-demo deploy/mysql -- \
  mysql -uroot -plynq-demo-password -vvv lynq_demo \
  -e "UPDATE customers SET active = FALSE WHERE id = 'acme';"
Terminal
--------------
UPDATE customers SET active = FALSE WHERE id = 'acme'
--------------

Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

Bye

Real output: Lynq 1.1.23 on Kubernetes v1.34.0, captured by website/scripts/capture/capture.sh

Its LynqNode is deleted, and with it the Deployment and Service:

Terminal
$ kubectl get deployments,services -n customers
NAME                        READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/beta-web    1/1     1            1           30s
deployment.apps/gamma-web   1/1     1            1           90s

NAME                TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)   AGE
service/beta-web    ClusterIP   10.96.182.162   <none>        80/TCP    30s
service/gamma-web   ClusterIP   10.96.25.79     <none>        80/TCP    81s

Real output: Lynq 1.1.23 on Kubernetes v1.34.0, captured by website/scripts/capture/capture.sh

The hub counts what it wants and what is Ready:

Terminal
$ kubectl get lynqhub customers -n customers
NAME        TEMPLATES   DESIRED   READY   FAILED   CONDITIONS          AGE
customers   1           2         2                DatabaseConnected   91s

Real output: Lynq 1.1.23 on Kubernetes v1.34.0, captured by website/scripts/capture/capture.sh

If something is stuck

No LynqNodes after a minute. Check the hub's conditions; a wrong password or host shows here:

kubectl describe lynqhub customers -n customers

A LynqNode is not Ready. Its conditions and events name the resource that failed:

kubectl describe lynqnode acme-web -n customers

The controller is not running. cert-manager must be Ready first:

kubectl get pods -n cert-manager
kubectl logs -n lynq-system deploy/lynq-controller-manager

More in Troubleshooting.

Clean up

kind delete cluster --name lynq

Next

  • Installation — a production or staging cluster
  • Datasources — connect your own database
  • Templates — what a LynqForm can render
  • Policies — keep resources on delete, take over existing ones, and more

On this page