# Connect Kubernetes clusters

Before installing groundcover in Kubernetes, please make sure your cluster meets the [requirements](https://docs.groundcover.com/getting-started/requirements).

After ensuring your cluster meets the requirements, complete the [login and workspace setup](https://docs.groundcover.com/getting-started/login-and-create-a-workspace), then choose your preferred installation method:

* [UI](#installing-using-ui)
* [CLI](#installing-using-cli)
* [Helm](#installing-using-helm)
* [ArgoCD](#installing-using-argocd)

{% hint style="info" %}
Coverage policy covers all nodes excluding control plane and fargate. [See details here](https://docs.groundcover.com/customization/customize-deployment/configuring-sensor-deployment-coverage).
{% endhint %}

## Creating helm values file

Sensor deployment requires installation values similar to these stored in a `values.yaml` file

```yaml
global:
  backend:
    enabled: false
  ingress:
    site: {BYOC_ENDPOINT}

clusterId: "your-cluster-name" # CLI will automatically detect cluster name
env: "your-environment-name" # Add it to differentiate between different environments
```

{% hint style="info" %}
**Default values:** If `clusterId` is not set, the CLI will auto-detect the cluster name. If `env` is not configured, the environment will display as **"none"** in the Cluster Picker. We recommend setting both values for better organization. [Learn more about environment labels](https://docs.groundcover.com/use-groundcover/add-custom-environment-labels).
{% endhint %}

`{BYOC_ENDPOINT}` is your unique groundcover ingestion endpoint, you can locate it in the [ingestion keys tab](https://app.groundcover.com/settings?selectedTab=ingestion-keys).

## Installing using CLI

Use groundcover CLI to automate the installation process. The main advantages of using this installation method are:

* Auto-detection of cluster incompatibility issues
* Tolerations setup automation
* Tuning of resources according to cluster size
* Supports passing helm overrides
* Automated detection of new versions and upgrades suggestions

Read more [here](https://github.com/groundcover-com/cli).

{% hint style="success" %}
The CLI will automatically use existing ingestion keys or provision a new one if none exist
{% endhint %}

#### **Installing groundcover CLI**

```bash
sh -c "$(curl -fsSL https://groundcover.com/install.sh)"
```

**Deploying groundcover using the CLI**

```bash
groundcover deploy -f values.yaml
```

To upgrade groundcover to the latest version, simply re-run the `groundcover deploy` command with your desired overrides (such as `-f values.yaml`). The CLI will automatically detect and apply the latest available version during the deployment process.

## Installing using Helm

### Step 1 - Install groundcover CLI

```bash
sh -c "$(curl -fsSL https://groundcover.com/install.sh)"
```

### Step 2 - Generate Installation Key

For more details about ingestion keys, refer to our [ingestion key documentation](https://docs.groundcover.com/use-groundcover/remote-access-and-apis/ingestion-keys).

```bash
groundcover auth get-ingestion-key sensor
```

### Step 3 - Add Sensor Ingestion Key to Values File

Add the recently created sensor key and your BYOC endpoint to the values.yaml file. Find your BYOC endpoint in the [ingestion keys tab](https://app.groundcover.com/settings?selectedTab=ingestion-keys).

```yaml
global:
  groundcover_token: {sensor_key}
  backend:
    enabled: false
  ingress:
    site: {BYOC_ENDPOINT}
    
clusterId: "your-cluster-name"
env: "your-environment-name"
```

{% hint style="info" %}
**Note:** Clusters without `env` configured will show **"none"** in the Cluster Picker. Set this value to organize clusters by environment (e.g., `prod`, `staging`, `dev`).
{% endhint %}

### Step 4 - Add Helm Repository

```bash
# Add groundcover Helm repository and fetch latest chart
helm repo add groundcover https://helm.groundcover.com && helm repo update groundcover
```

### Step 5 - Install groundcover

Initial installation:

```bash
helm upgrade \
    groundcover \
    groundcover/groundcover \
    -i \
    --create-namespace \
    -n groundcover \
    -f values.yaml
```

Upgrade groundcover:

```bash
helm repo update groundcover && helm upgrade \
    groundcover \
    groundcover/groundcover \
    -n groundcover \
    -f values.yaml
```

## Installing using ArgoCD

For CI/CD deployments using ArgoCD, refer to our [ArgoCD deployment guide](https://docs.groundcover.com/customization/customize-deployment/argo-cd).

## **What can you do next?**

Check out our [5 quick steps to get you started](https://docs.groundcover.com/getting-started/5-quick-steps-to-get-you-started)

## Uninstalling

### CLI

```bash
groundcover delete
```

### Helm

```bash
helm uninstall groundcover -n groundcover
```

```bash
# delete the namespace in order to remove the PVCs as well
kubectl delete ns groundcover
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.groundcover.com/getting-started/installation-and-updating/connect-kubernetes-cluster.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
