> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Running The Operator With Make Run

> Using make run runs the operator locally against a real cluster for fast iterative development and debugging of reconcile logic before packaging and in-cluster deployment.

Using `make run` moves the operator's brain from a pod in the cluster to a process on your workstation while it still manipulates real cluster objects. This gives you a fast, interactive workbench to iterate on reconcile logic before you package or deploy anything.

The cluster is the building; the controller is the technician with a radio. In production the technician works inside the building (as a pod). During local development the technician sits at your desk, but

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/_cG0RWHUHqfjYKx0/images/Kubernetes-Operators/Running-Testing-Debugging-Locally/Running-The-Operator-With-Make-Run/in-production-local-dev-comparison.jpg?fit=max&auto=format&n=_cG0RWHUHqfjYKx0&q=85&s=c6f4df2e86bf24ca1578140dbdb7294e" alt="The image compares &#x22;In Production&#x22; with &#x22;Local dev&#x22; environments, showing a technician working inside a pod in production and a stick figure holding a tool on a table." width="1920" height="1080" data-path="images/Kubernetes-Operators/Running-Testing-Debugging-Locally/Running-The-Operator-With-Make-Run/in-production-local-dev-comparison.jpg" />
</Frame>

the radio still reaches the building. The API server is that radio link: Deployments, Services, ConfigMaps and other web app resources remain real cluster objects that your locally-run controller reads and modifies.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/_cG0RWHUHqfjYKx0/images/Kubernetes-Operators/Running-Testing-Debugging-Locally/Running-The-Operator-With-Make-Run/cluster-schematic-objects-real-icons.jpg?fit=max&auto=format&n=_cG0RWHUHqfjYKx0&q=85&s=5fa69134c1bbb20dc08bf6926a345585" alt="The image shows a schematic of a building labeled &#x22;Cluster&#x22; with icons representing different components and text indicating &#x22;The Objects Are Still Real&#x22; and &#x22;Real objects, not mocked.&#x22;" width="1920" height="1080" data-path="images/Kubernetes-Operators/Running-Testing-Debugging-Locally/Running-The-Operator-With-Make-Run/cluster-schematic-objects-real-icons.jpg" />
</Frame>

Why use local mode? It shortens the edit → run → observe loop:

* Stop the manager.
* Change the code.
* Start the manager locally.
* Apply a WebApp resource.
* Observe what the controller does.

This is the quickest way to answer: did my reconcile logic behave the way I expect?

Before the controller can act on a custom resource, the API server must know the resource schema. `make install` applies the CustomResourceDefinition (CRD) for the WebApp type so the API server recognizes it. If the CRD is not installed, the cluster cannot understand the object you want to watch even if your controller is running.

```bash theme={null}
# Install the CRD so the API server recognizes the WebApp type
make install

# Run the controller manager locally (connects to the cluster using your kubeconfig)
make run

# Apply a sample WebApp to exercise reconcile behavior
kubectl apply -f config/samples/webapp_v1alpha1_webapp.yaml
```

Think of the manager as a local process that hosts your controller and talks to the API server using the kubeconfig on your machine. To the cluster it is just another API client; to you it is an easily stoppable, restartable, and observable process.

Use the following quick-reference to map steps to their intent:

| Command / Action                       | What question it answers                                             |
| -------------------------------------- | -------------------------------------------------------------------- |
| `make install`                         | Does the cluster know this API type (is the CRD installed)?          |
| `make run`                             | Can my controller watch that type and react (is reconcile wired up)? |
| `kubectl apply -f config/samples/...`  | What does my controller do with a real resource?                     |
| `kubectl get` / logs / manager console | What actually happened — resource state and runtime evidence?        |

When running locally, you will typically check the manager output in your terminal (where `make run` runs) and use `kubectl get` to inspect resource state. For cluster-side evidence, use `kubectl` (for example `kubectl get webapp -A`) and for in-cluster components inspect Pod logs once you deploy the packaged controller.

<Callout icon="lightbulb" color="#1CB2FE">
  Use local mode for fast feedback on reconcile logic and resource reads/writes. Treat it as a development workbench: quick, iterative testing to validate behavior before you move on to packaging and in-cluster validation.
</Callout>

Local mode is powerful, but it has limits. It can validate reconcile behavior, confirm reads and writes against real objects, and produce log evidence. It cannot prove final production concerns such as the exact deployment shape, service account permission boundaries (your kubeconfig user can be more privileged than the controller's in-cluster identity), leader election behavior, webhook admission controllers, or production networking and RBAC interactions.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/_cG0RWHUHqfjYKx0/images/Kubernetes-Operators/Running-Testing-Debugging-Locally/Running-The-Operator-With-Make-Run/local-mode-capabilities-limitations-summary.jpg?fit=max&auto=format&n=_cG0RWHUHqfjYKx0&q=85&s=fa871b4568bacf3c2dad28eb6f8a0a85" alt="The image lists the capabilities and limitations of local mode, highlighting what it can and cannot prove about system behavior. It includes items like reconciled behavior, object reads and writes, and log evidence on the left, while limitations such as final deployment shape and service account permissions are noted on the right." width="1920" height="1080" data-path="images/Kubernetes-Operators/Running-Testing-Debugging-Locally/Running-The-Operator-With-Make-Run/local-mode-capabilities-limitations-summary.jpg" />
</Frame>

Those checks belong in subsequent stages of testing and CI. For now, use local mode for what it does best: rapid iteration and evidence-driven debugging. Later, the workbench output becomes the raw material for deeper debugging, packaging, and production verification.

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/kubernetes-operators/module/245c1684-705c-4a53-9f56-897dfaf25c71/lesson/c597f5fe-d6ad-4c91-8b27-2cb6c9bbdb28" />
</CardGroup>
