> For the complete documentation index, see [llms.txt](https://docs.cennso.com/cennso/netcap/latest/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/cennso/netcap/latest/concepts/netcapclusterdeployment.md).

# `NetCapClusterDeployment` CR

`NetCapClusterDeployment` Custom Resource (CR) installs NetCap components on a single Core Cluster and enables traffic capture from that cluster. You create this CR on the Management Cluster. Create one instance for every Core Cluster you want to capture traffic from.

> [!IMPORTANT]
> Before you deploy the `NetCapClusterDeployment` CR, install the NetCap extension and the [Cennso Data Mesh](https://docs.cennso.com/cennso/cdm/latest.md) extension on the Management Cluster. For the full list of dependencies, see [Requirements](https://docs.cennso.com/cennso/netcap/latest/installation.md#requirements).

`NetCapClusterDeployment` is a Crossplane claim, so you can configure it in two ways:

- Cennso Management Console (CMC) renders the parameters as collapsible sections of the **Specification** tab.
- The `kubectl` command line applies a YAML manifest that sets the same parameters directly.

Both methods write to the same CR. For the step-by-step procedure for each method, see [Install NetCap components on a Core Cluster](https://docs.cennso.com/cennso/netcap/latest/installation.md#install-netcap-components-on-a-core-cluster). After the deployment reports ready, you can configure packet capture (PCAP) collection with the `NetCaptureStorage` and `NetCaptureJob` CRs, described in [About PCAP capturing](https://docs.cennso.com/cennso/netcap/latest/concepts/pcap-capturing.md).

## Deployed components

Each `NetCapClusterDeployment` CR installs the following NetCap components in the `cennso-system` namespace of the target Core Cluster:

- A [Cennso Data Mesh](https://docs.cennso.com/cennso/cdm/latest.md#cennso-data-mesh) instance that carries PCAP data between NetCap Collector and NetCap Sink.
- NetCap Collector as a DaemonSet. The NetCap Collector pods run on Data Plane nodes. To place them on other nodes, see [Pod placement](#pod-placement).
- NetCap Sink as a StatefulSet.

The Data Mesh instance starts first, and the NetCap components follow. A fresh deployment can report `READY` as `False` for several minutes while it waits for all NetCap components to become ready.

## Target Core Cluster

**spec.connectionSecretRef** is the only required parameter. It points to the Secret that holds the kubeconfig of the Core Cluster where NetCap installs its components. Set these fields:

- **name** is the name of the Secret.
- **namespace** is the namespace of the Secret on the Management Cluster.
- **key** is the key inside the Secret data that holds the kubeconfig. The default value is `kubeconfig`.

The following snippet points the deployment at a Core Cluster whose kubeconfig is stored in the `cennso-infra` namespace:

```yaml
spec:
  connectionSecretRef:
    name: {CORE_CLUSTER_SECRET_NAME}
    namespace: cennso-infra
    key: kubeconfig
```

NetCap also uses **spec.connectionSecretRef.name** as the cluster name in the Cennso Data Mesh configuration of NetCap Collector and NetCap Sink. NetCap builds communication channels, Key-Value store entries and data consumers names from that value, so a change to the Secret name also changes those identifiers.

## Composition and version selection

A Crossplane composition renders the deployment. Three parameters control which composition and which revision of it the deployment uses:

- **spec.compositionRef.name** selects the composition. The default value is `netcap-core-cluster-deployment`.
- **spec.compositionUpdatePolicy** sets whether the deployment follows new composition revisions. The default value is `Manual`, which keeps the deployment on the revision it started with. Set it to `Automatic` to follow the revision that **spec.compositionRevisionSelector** matches.
- **spec.compositionRevisionSelector.matchLabels** selects the composition revision by label.

To pin the deployment to one NetCap version, set **spec.compositionUpdatePolicy** to `Automatic` and match the `cennso.com/version` label:

```yaml
spec:
  compositionUpdatePolicy: Automatic
  compositionRef:
    name: netcap-core-cluster-deployment
  compositionRevisionSelector:
    matchLabels:
      cennso.com/version: "{NETCAP_VERSION}"
```

For the complete parameter list, including the remaining Crossplane claim fields, see [NetCapClusterDeployment](https://docs.cennso.com/cennso/netcap/latest/technical-reference/configurations/cennso-netcap/xnetcapclusterdeployment_definition.md).

## Helm chart source

NetCap installs its components from a Helm chart stored in an Open Container Initiative (OCI) registry. By default, the deployment resolves the registry from the default pull secret installed on the Management Cluster.

Set **spec.chart** to install the chart from a different location:

- **repository** is the chart repository URL.
- **tag** is the chart version. If you omit this field, the deployment uses the chart version that ships with the `cennso-netcap` Configuration package.

The following snippet installs a named chart version from a custom registry:

```yaml
spec:
  chart:
    repository: oci://registry.cennso.com/cennso/charts/netcap
    tag: "{CHART_VERSION}"
```

Set **spec.pullSecretRef.name** to pull the chart with different credentials. The Secret must exist in the `cennso-system` namespace of the Management Cluster:

```yaml
spec:
  pullSecretRef:
    name: {PULL_SECRET_NAME}
```

The deployment installs nothing until it can resolve a registry. Set **spec.chart.repository**, or install a default pull secret on the Management Cluster. While neither is available, the deployment reports a `DependenciesReady` condition with the `WaitingForDependencies` reason and a message that names what is missing. After the registry or the pull secret becomes available, the condition switches to `AllDependenciesReady` and the installation proceeds.

## Data Mesh mode

**spec.dataMeshHA** controls how many Cennso Data Mesh pods run on the Core Cluster:

- `false`, the default value, deploys a single pod.
- `true` deploys three pods in High Availability (HA) mode.

Each pod requests `500m` CPU and `1Gi` of memory. HA mode keeps the PCAP data path available while one Data Mesh pod restarts, at the cost of three times the resources.

In CMC, this parameter appears in the **Data Mesh** section of the **Specification** tab.

## Pod placement

Four parameters control where the pods run:

- **spec.collectorAffinity** sets node affinity for the NetCap Collector pods. The default rule targets nodes labeled `node-role.cennso.net/worker: dataplane`.
- **spec.collectorTolerations** sets tolerations for the NetCap Collector pods. The default value tolerates the `node-role.cennso.net/dataplane=true:NoSchedule` taint.
- **spec.sinkAffinity** sets node affinity for the NetCap Sink pod. By default, no affinity rule applies.
- **spec.sinkTolerations** sets tolerations for the NetCap Sink pod. The default value tolerates the `node-role.cennso.net/dataplane=true:NoSchedule` taint.

All four parameters take standard Kubernetes syntax. A value you set replaces the default instead of merging with it.

The following snippet moves NetCap Sink to nodes labeled `node-role.cennso.net/worker: generic` and lets it tolerate the control-plane taint:

```yaml
spec:
  sinkAffinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
            - key: node-role.cennso.net/worker
              operator: In
              values:
              - "generic"
  sinkTolerations:
    - effect: NoSchedule
      key: node-role.cennso.net/control-plane
      value: "true"
```

An empty **spec.collectorAffinity** keeps the default rule. To clear the default, set an empty **nodeAffinity** inside it. The following snippet lets the NetCap Collector pods schedule on any node:

```yaml
spec:
  collectorAffinity:
    nodeAffinity: {}
```

For more information about these Kubernetes mechanisms, read the official documentation on [assigning pods to nodes](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node) and on [taints and tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration).

## SSH private keys for SFTP storage

A `NetCaptureStorage` CR can upload PCAP files to a Secure File Transfer Protocol (SFTP) server with key-based authentication. NetCap Sink then needs the Secure Shell (SSH) private key. Two parameters make keys available to the NetCap Sink container:

- **spec.additionalSshPrivKeySecretNames** lists the names of Secrets that already exist in the `cennso-system` namespace of the Core Cluster.
- **spec.additionalSshPrivKeys** holds `name` and `value` pairs. NetCap creates the Secrets on the Core Cluster and attaches them to NetCap Sink.

> [!CAUTION]
> **spec.additionalSshPrivKeys** stores the private key inside the CR, so anyone who can read the CR can read the key. Use **spec.additionalSshPrivKeySecretNames** instead to keep key material out of the CR.

The following snippet makes one existing Secret and one inline key available to NetCap Sink:

```yaml
spec:
  additionalSshPrivKeySecretNames:
    - {EXISTING_SECRET_NAME}
  additionalSshPrivKeys:
    - name: {KEY_NAME}
      value: |-
        -----BEGIN OPENSSH PRIVATE KEY-----
        {BASE64_ENCODED_KEY}
        -----END OPENSSH PRIVATE KEY-----
```

For the matching storage-side configuration, see [Key-based authentication](https://docs.cennso.com/cennso/netcap/latest/concepts/netcapturestorage.md#key-based-authentication).

## NetCap Sink environment variables and volumes

NetCap Sink uses [rclone](https://rclone.org/) for S3 and SFTP storage. NetCap Sink also reads rclone settings from environment variables, so you can set options that the `NetCaptureStorage` CR does not expose as a field.

Three optional parameters add container-level settings to NetCap Sink:

- **spec.sinkEnv** sets environment variable entries on the NetCap Sink container.
- **spec.sinkVolumes** adds volumes to the NetCap Sink pod.
- **spec.sinkVolumeMounts** adds volume mounts to the NetCap Sink container.

All three parameters take standard Kubernetes syntax. An environment variable can read its value from a Secret, and a volume can mount a Secret or a ConfigMap.

NetCap Sink reads two kinds of environment variables:

- `RCLONE_` variables set rclone options, with the backend name in the prefix. For example, `RCLONE_S3_UPLOAD_CONCURRENCY` sets the S3 upload concurrency.
- `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` supply S3 credentials. They apply when the `NetCaptureStorage` CR sets **spec.forProvider.s3.env_auth** to `true` and leaves the two key parameters empty.

The following snippet raises the S3 upload concurrency and supplies the credentials from a Secret:

```yaml
spec:
  sinkEnv:
    - name: RCLONE_S3_UPLOAD_CONCURRENCY
      value: "8"
    - name: AWS_ACCESS_KEY_ID
      valueFrom:
        secretKeyRef:
          name: {S3_SECRET_NAME}
          key: access_key_id
    - name: AWS_SECRET_ACCESS_KEY
      valueFrom:
        secretKeyRef:
          name: {S3_SECRET_NAME}
          key: secret_access_key
```

For the matching storage-side configuration, see [S3 storage](https://docs.cennso.com/cennso/netcap/latest/concepts/netcapturestorage.md#s3-storage).

In CMC, these parameters appear in the **Deployment configuration** section of the **Specification** tab. The field labels are **NetCap Sink Environment Variables list**, **NetCap Sink Volumes list**, and **NetCap Sink Volume Mounts list**.
