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

# Deploying a Runner with Kubernetes

> Deploy a Blink self-hosted runner on a Kubernetes cluster using Helm charts.

## Prerequisites

1. **Kubernetes Cluster**: You need to have a Kubernetes cluster up and running. This can be an on-premises cluster or a cloud-based Kubernetes service like Amazon EKS, Google Kubernetes Engine (GKE), or Azure Kubernetes Service (AKS).
2. **Blink User:** You must have either the [Owner role](/docs/blink-platform/account-management/roles#1-owner),[Contributor role](/docs/blink-platform/account-management/roles#2-contributor), or a [custom role](/docs/blink-platform/account-management/roles#adding-a-new-role) that includes both the `runners:view` and `runners:edit` permissions. To learn more about role-based access and permissions, see the [User Roles documentation](/docs/blink-platform/account-management/roles).
3. **(Optional)-SSH Access to Kubernetes Cluster:** If you need to manually manage your Kubernetes cluster or troubleshoot any issues, you should have SSH access or appropriate permissions to interact with the cluster.
   <Tip> Make sure you have the kubectl installed, Kubernetes command-line (CLI) tool for managing your clusters. Detailed instructions can be found in the official [Kubernetes documentation](https://kubernetes.io/docs/tasks/tools/).</Tip>

***

## Deployment Guide

<Steps>
  <Step title="Navigate to the Runners page">
    In the left-hand navigation bar, select **Runners**. Then, click the **New Runner** button in the top-right corner to open the configuration dialog.
  </Step>

  <Step title="Configure the Runner:">
    * **Runner types**: Kubernetes

    * **Name**: Enter a name for the Runner group.

    * **Tags**: Add or create tags (optional).

    * **Set as default runner:** Check this box to set this Runner group as the default. When enabled, any workflows that do not explicitly specify a Runner group will automatically be assigned to this one.
          <Frame>
            <img src="https://mintcdn.com/blinkops-2/1pO3XQRCbXuOwOgX/img/Runners/KubernetesRunnerConfig.png?fit=max&auto=format&n=1pO3XQRCbXuOwOgX&q=85&s=1aa30d9dd632f613bf8060793b49693c" width="1728" height="1085" data-path="img/Runners/KubernetesRunnerConfig.png" />
          </Frame>

    * **Proxy Configuration**: When enabled, it allows you to configure a proxy server that all runners in the runner group will use for outbound network traffic. This enables secure, controlled access to external resources through your organization's network.
      * **HTTP Proxy (optional)**- eg. `http://proxy.company.com:8443`
      * **HTTPS Proxy (optional)**- eg. `https://proxy.company.com:8443`
      * **No Proxy (optional)**- eg. `localhost`,`127.0.0.1`
        <Note>**Note**: If you enable 'Proxy Configuration' and configure the proxy settings, they will automatically be included in the installation command shown in the next steps.</Note>
          <Frame>
            <img src="https://mintcdn.com/blinkops-2/1pO3XQRCbXuOwOgX/img/Runners/KubernetesProxy.png?fit=max&auto=format&n=1pO3XQRCbXuOwOgX&q=85&s=1ea00bd188b5bb4a4c6f4ee91401936f" width="1723" height="1084" data-path="img/Runners/KubernetesProxy.png" />
          </Frame>
  </Step>

  <Step title="Choose a Runner Profile, Copy and Save the Command">
    * **Runner Profile**: Choose between the following runner profile options: **Low, Medium, High or Custom**. This allows you to better manage your resource containers and pods. To read more about it you can visit [resource container links](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/).

    * Click the <Icon icon="copy" /> button in the top-right corner to copy command needed to install the Runner in your Kubernetes environment.

    <Warning>**WARNING**:Please be aware that the provided command contains the registration token of the Runner, which will not be retrievable after copying. It is essential to securely store this token in a safe location for future reference.</Warning>

    <Frame>
      <img src="https://mintcdn.com/blinkops-2/1pO3XQRCbXuOwOgX/img/Runners/KubernetesHelmCommand.png?fit=max&auto=format&n=1pO3XQRCbXuOwOgX&q=85&s=56cc2abba3aa5b968e3cf1f834dbd80a" width="861" height="539" data-path="img/Runners/KubernetesHelmCommand.png" />
    </Frame>
  </Step>
</Steps>

***

## Plugin Resource Control

<Accordion title="Low Runners Profile Request-Limit Table">
  <div className="flow-table">
    | Parameter      | Request | Limit  |
    | -------------- | ------- | ------ |
    | Plugin CPU     | 200m    | 2000m  |
    | plugin Memory  | 250Mi   | 1000Mi |
    | plugin Storage | 2Gi     | 4Gi    |
  </div>
</Accordion>

<Accordion title="Medium Runners Profile Request-Limit Table">
  <div className="flow-table">
    | Parameter      | Request | Limit  |
    | -------------- | ------- | ------ |
    | plugin CPU     | 400m    | 4000m  |
    | plugin Memory  | 600Mi   | 1800Mi |
    | plugin Storage | 4Gi     | 6Gi    |
  </div>
</Accordion>

<Accordion title="High Runners Profile Request-Limit Table">
  <div className="flow-table">
    | Parameter      | Request | Limit  |
    | -------------- | ------- | ------ |
    | plugin CPU     | 600m    | 6000m  |
    | plugin Memory  | 900Mi   | 2400Mi |
    | plugin Storage | 6Gi     | 8Gi    |
  </div>
</Accordion>

<Accordion title="Custom Runners Profile Request-Limit Table">
  If you choose the 'Custom Option' as your Runners Profile, you will be able to enter your own **Request Units** and **Limits Units**. For Example:

  <Frame>
    <img src="https://mintcdn.com/blinkops-2/hCOHuAN1Lx4x4ZwJ/img/Runners/CustomRunner.gif?s=1431c4b440b5c6121911dc85ef39fab3" width="600" height="609" data-path="img/Runners/CustomRunner.gif" />
  </Frame>
</Accordion>

## Configuring Runner Resource Limitations

<AccordionGroup>
  <Accordion title="Set Pod Request" icon="circle-1">
    Use the following flags when deploying the Runner to set pod requests:

    ```bash theme={"dark"}
    --set plugins.requests.core_cpu="400m" // The CPU request for plugin containers
    --set plugins.requests.core_memory="650Mi" // The Memory request for plugin containers
    --set plugins.requests.core_storage="4Gi" // The Storage request for plugin containers
    ```
  </Accordion>

  <Accordion title="Set Pod Limits" icon="circle-2">
    Use the following flags when deploying the Runner to set pod limits:

    ```bash theme={"dark"}
    --set plugins.limits.core_cpu="400m" // The CPU limit for plugin containers
    --set plugins.limits.core_memory="650Mi" // The Memory limit for plugin containers
    --set plugins.limits.core_storage="4Gi" // The Storage limit for plugin containers
    ```
  </Accordion>
</AccordionGroup>

***

### Scale with Kubernetes Runner

In Kubernetes, you can take advantage of the built-in 'Horizontal Pod Autoscaler' (HPA) to automatically scale your workloads. Instead of manually specifying a fixed number of pods, you define the minimum and maximum pod count, and Kubernetes adjusts the number based on resource usage. This approach works seamlessly with both runners and plugins, allowing you to scale them dynamically based on demand.

<Steps>
  <Step>
    **Enable Horizontal Pod Autoscaler (HPA)** for the Kubernetes Runner deployment by including the following addition in the helm command: `--set hpa=true`.
  </Step>

  <Step>
    **Configure the Horizontal Pod Autoscaler (HPA)** for the Kubernetes Runner deployment by including the following addition in the helm command:

    ```helm theme={"dark"}
    --set minReplicas={minReplicas} (The default value is set to 3)
    --set maxReplicas={maxReplicas} (The default value is set to 6)
    --set targetCPUUtilizationPercentage={targetCPUUtilizationPercentage} (The default value is set to 80%)
    --set targetMemoryUtilizationPercentage={targetMemoryUtilizationPercentage} (The default value is set to 80%)
    ```
  </Step>
</Steps>

### Scale Plugins with Kubernetes Runner

<Note>**Note:** This configuration currently does not affect core plugins, but we are working on it and support will be available soon.</Note>

<Steps>
  <Step>
    **Enable Horizontal Pod Autoscaler (HPA)** for the plugins deployed by the runner using the following addition to the helm command:

    ```helm theme={"dark"}
    --set plugins.hpa.enabled=true
    ```
  </Step>

  <Step>
    **Configure the Horizontal Pod Autoscaler (HPA)** for the plugins deployed by the runner using the following addition to the helm command:

    ```helm theme={"dark"}
    --set plugins.hpa.minReplicas={minReplicas} (The default value is set to 2)
    --set plugins.hpa.maxReplicas={maxReplicas} (The default value is set to 4)
    --set plugins.hpa.targetCPUUtilizationPercentage={targetCPUUtilizationPercentage} (The default value is set to 60%)
    --set plugins.hpa.targetMemoryUtilizationPercentage={targetMemoryUtilizationPercentage} (The default value is set to 60%)
    ```
  </Step>
</Steps>

***

## Related Articles

<CardGroup cols={2}>
  <Card title="Deploying a Runner" icon="code-fork" href="/docs/blink-platform/runners/deploying-runner/deploying-self-hosted">
    Learn how to deploy a Blink Runner to execute workflows securely within your environment.
  </Card>

  <Card title="Deploying a Runner with CloudFormation" icon="aws" href="/docs/blink-platform/runners/deploying-runner/cloud-formation-runner">
    Guide to installing, configuring and deploying a Runner using CloudFormation
  </Card>

  <Card title="Deploying a Runner with Docker" icon="docker" href="/docs/blink-platform/runners/deploying-runner/dockers-runner">
    Guide to installing, configuring and deploying a Runner using Docker
  </Card>

  <Card title="Configuring a Runner Group" icon="rectangle-history" href="/docs/blink-platform/runners/deploying-runner/runner-group">
    Deploy multiple on-prem Runners for high availability, parallel execution, or workload isolation.
  </Card>
</CardGroup>
