github.com/smartcontractkit/chainlink-testing-framework/libs@v0.0.0-20240227141906-ec710b4eb1a3/docs/quickstart/local-k8s-setup.md (about)

     1  ---
     2  layout: default
     3  title: Kubernetes Cluster
     4  nav_order: 1
     5  parent: Quick Start
     6  ---
     7  
     8  # Kubernetes Cluster
     9  
    10  In order to run tests, we need a [Kubernetes](https://kubernetes.io/) (often abbreviated as *K8s*) cluster, and a way to connect to it (see [why Kubernetes](https://smartcontractkit.github.io/integrations-framework/setup/kubernetes.html#why)).
    11  
    12  In order to connect to a K8s cluster, we need to [download kubectl](https://kubernetes.io/releases/download/). This will let you connect to and control any Kubernetes cluster.
    13  
    14  Next you'll need to get a Kubernetes cluster running. If you're lucky, you'll have one running in the cloud somewhere that you can utilize. But if you don't, or just want to get something running locally, you can use [Docker](https://www.docker.com/) and [K3D](https://k3d.io/) to launch a local Kubernetes cluster.
    15  
    16  <div class="note note-purple">
    17  The Kubernetes setup process, and the resources needed to run a K8s cluster for these tests is a common pain point. We're exploring ways to lessen the resources needed, and possibly expand to other systems as well as Kubernetes.
    18  </div>
    19  
    20  ## Local Kubernetes Cluster
    21  
    22  First up, [install Docker](https://docs.docker.com/get-docker/) if you haven't already, then [install K3D](https://k3d.io/#installation). These two technologies will enable you to run a lightweight Kubernetes cluster on your machine quickly.
    23  
    24  ### Configure Docker
    25  
    26  Docker will need a little more power than its default in order to run our tests, especially if we want to run many of them at once. In Docker Desktop, you can go to `Settings (the gear in the top right) -> Resources -> Advanced` to change how much power to give Docker. It will depend on your personal machine's specs, but a good starting point for some basic tests is 4CPUs and 4GB RAM.
    27  
    28  ![docker resources](../assets/images/docker-resources.png)
    29  
    30  ### K3D Local Cluster
    31  
    32  `k3d cluster create`
    33  
    34  After a few minutes, the above command will deploy a local Kubernetes cluster on your machine! Use the below commands to check that things are working correctly.
    35  
    36  ```sh
    37  > kubectl cluster-info
    38  Kubernetes control plane is running at https://0.0.0.0:60887
    39  CoreDNS is running at https://0.0.0.0:60887/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
    40  Metrics-server is running at https://0.0.0.0:60887/api/v1/namespaces/kube-system/services/https:metrics-server:https/proxy
    41  > kubectl get ns
    42  NAME              STATUS   AGE
    43  default           Active   114s
    44  kube-system       Active   114s
    45  kube-public       Active   114s
    46  kube-node-lease   Active   114s
    47  ```
    48  
    49  You can use the `kubectl` CLI to control and view the Kubernetes cluster if you're handy with it, and we'll be using those commands for simplicities sake. You can also use [Lens](https://k8slens.dev/), a handy GUI that simplifies things a bit. Use the below command to tear down the cluster.
    50  
    51  `k3d cluster delete`
    52  
    53  <div class="note note-yellow">
    54  Not deleting your cluster when not in use means that it will continue to use up your machine's resources.
    55  </div>