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

# Triton Provider

The Triton Provider for Managed Kubernetes utilizes Triton Private Cloud to provision Kubernetes clusters.

Because native load balancers are not supported, you must configure a managed load balancer instance during the cluster creation process. Logs are captured via [Syslog](/external-logging/syslog).

## Requirements

* A Triton account with API access
* An OpenSSH private key as a Control Plane opaque secret
* A private network configured in your datacenter
* `triton-moirai` images available in your datacenter

## Supported Add-ons

* [Dashboard:](/mk8s/add-ons/dashboard) Provides a Kubernetes dashboard UI for the cluster.
* [Headlamp:](/mk8s/add-ons/headlamp) The recommended dashboard for the cluster
* [Local Path Storage:](/mk8s/add-ons/local_path_storage) Create PVCs backed by local volumes.
* [Logs:](/mk8s/add-ons/logs) Enable logging for pods and cluster auditing.
* [Metrics:](/mk8s/add-ons/metrics) Enable metrics collections.

## Load Balancing

Triton does not include a native load balancer. To expose cluster endpoints, you must configure a manual load balancer while configuring the cluster, and Control Plane deploys and configures the instance in your datacenter. The load balancer acts as a gateway and it must be attached to the `publicNetworkId` to receive traffic and the `privateNetworkIds` to reach the worker nodes.

<Note>
  `triton-moirai` images must already be built and available in your Triton datacenter before creating the cluster.
</Note>

## Logging

When using a load balancer, logs are written to syslog. Choose one of the following options:

* **`externalSyslog`** — Forward the log sink to a syslog server outside the cluster, specified as `host:port`.
* **`nodePort`** — If you run a syslog service inside the cluster and expose it via a Kubernetes NodePort, point the log sink to that port number (valid range: `30000`–`65535`).

## Step 1 — Prepare Your Triton Environment

Your Triton environment must include:

1. **`Datacenter capacity`**: Verify that your datacenter has enough capacity for the number of nodes you're planning to run.
2. **`Private network`**: Set up at least one private network for backend traffic between worker nodes.
3. **`Instance types`**: Make sure the instance types you need are available for both the node pool and the load balancer.
4. **`triton-moirai images`**: Have your triton-moirai machine images ready and accessible in your datacenter.

## Step 2 — Create a Managed Kubernetes Cluster Using a Manifest File

1. **Update the manifest below**: Modify the following `triton-mk8s-template.yaml` YAML manifest with actual values. Replace the \${PLACEHOLDER} values in the YAML below with your actual values before applying.

```yaml YAML theme={null}
kind: mk8s
name: ${NAME}
spec:
  provider:
    triton:
      connection:
        account: ${ACCOUNT}
        privateKeySecretLink: //secret/${SECRET}
        url: ${URL}
      imageId: ${IMAGE_ID}
      loadBalancer:
        manual:
          tags:
            my-key-sample: my-value-sample
          cnsInternalDomain: ${CNS_INTERNAL_DOMAIN}
          cnsPublicDomain: ${CNS_PUBLIC_DOMAIN}
          count: 1
          imageId: ${LB_IMAGE_ID}
          metadata:
            my-meta-key: my-meta-value
          packageId: ${LB_PACKAGE_ID}
          privateNetworkIds:
            - ${LB_PRIVATE_NETWORK_ID}
          publicNetworkId: ${LB_PUBLIC_NETWORK_ID}
      location: ${LOCATION}
      networking:
        podNetwork: ${POD_NETWORK_CIDR}
        serviceNetwork: ${SERVICE_NETWORK_CIDR}
      nodePools: # At least one node pool is required.
        - name: private
          labels:
            cpln.io/nodeType: core
            internet: false
          maxSize: 4
          minSize: 1
          packageId: ${PRIVATE_PACKAGE_ID}
          tritonTags:
            hello: world
      privateNetworkId: ${PRIVATE_NETWORK_ID}
  addOns:
    headlamp: {}
  firewall:
    - description: public access for testing purposes
      sourceCIDR: 0.0.0.0/0
  version: 1.34.2
```

2. **Create the Cluster**: Deploy the cluster by applying the manifest.

   * **Console**: Apply the `triton-mk8s-template.yaml` file using the `cpln apply >_` option in the upper right corner.
   * **CLI**: Execute `cpln apply -f triton-mk8s-template.yaml --org YOUR_ORG_HERE`.

   **Wait until the cluster is initialized.**

## Step 3 — Accessing the Cluster

### 1. Using the Terminal

1. **Obtain the Cluster's Kubeconfig File**: Execute the command `cpln mk8s kubeconfig ${NAME} -f /tmp/triton-mk8s-conf`.
2. **Access the Cluster with `kubectl`**: Use the obtained kubeconfig file by running `export KUBECONFIG=/tmp/triton-mk8s-conf` for the current shell session.

### 2. Using Headlamp

1. **Navigate to Control Plane Console**: Visit the [Control Plane Console](https://console.cpln.io/console/).
2. **Access Headlamp**: In the Control Plane Console, navigate to `Kubernetes` in the left sidebar panel and click on `Open` under `Headlamp` for the cluster.

## Advanced Configuration Options

### Instance Rotation/Refresh

Sometimes an explicit rotation (or refresh) of the instances is needed, for example to get the latest image or a new boot disk size.

To do this per node pool, add a label `cpln.io/refreshToken` with an arbitrary valid value. Every time the value of this label changes, a conservative instance replacement will start (1 instance at a time). Removing that label is the same as having an empty value and will trigger a refresh too.
