# Kubernetes deployment

Define how to deploy your app from one of the **Build Method** options.

| Option                    | Overview                                                           |
| ------------------------- | ------------------------------------------------------------------ |
| [Web editor](#web-editor) | Use the Portainer web editor to write or paste in your build file. |
| [Upload](#upload)         | Upload a build file from your computer.                            |
| [Repository](#repository) | Use a GitHub repo where the build file is stored.                  |

<figure><img src="/files/YW38lOGwgSGJgA5Bu2Qr" alt=""><figcaption></figcaption></figure>

### Web editor

Use the web editor to define the services for your deployment.

{% hint style="info" %}
You can search within the web editor at any time by pressing `Ctrl-F` (or `Cmd-F` on Mac).

The web editor will visually highlight invisible special characters such as non-breaking spaces, helping you identify hidden characters that may cause unexpected errors in your configuration.
{% endhint %}

<figure><img src="/files/NOISfmBo1Wnrti8Ncoc7" alt=""><figcaption></figcaption></figure>

### Upload

Click **Select a file** to upload a file from your computer containing your stack definition.

<figure><img src="/files/lrhB0XGjgbh38wT1mN1L" alt=""><figcaption></figcaption></figure>

### Repository

Enter the information about your Git repository to deploy your Edge Stack from Git.

{% hint style="warning" %}
Portainer's Git deployment functionality does not currently support the use of Git submodules. If your repository includes submodules, they will not be pulled as part of the deployment. We [hope to add support](https://github.com/orgs/portainer/discussions/9767) for submodules in a future release.
{% endhint %}

| Field/Option          | Overview                                                                                                                                                                                                                                                                                                                                                                                                               |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Authentication        | Toggle this on if your Git repository requires authentication.                                                                                                                                                                                                                                                                                                                                                         |
| Git Credentials       | If the **Authentication** toggle is enabled and you have configured [individual](/sts/user/account-settings.md#git-credentials) or [shared](/sts/admin/settings/credentials/git.md) Git credentials, you can select them from this dropdown. Shared Git credentials can be identified with the **Shared** tag, and are only available to administrators at present. Leave this field unset to provide new credentials. |
| Username              | Enter your Git username.                                                                                                                                                                                                                                                                                                                                                                                               |
| Personal Access Token | <p>Enter your personal access token or password.<br>Ensure your token has repository read permissions. See the <a href="/pages/es73X5NqVnc8IccX6UbD">Git authentication token permissions FAQ</a>.</p>                                                                                                                                                                                                                 |
| Save credential       | Check this option to save the credentials entered above for future use under the name provided in the **credential name** field.                                                                                                                                                                                                                                                                                       |

{% hint style="info" %}
If you have 2FA configured in GitHub, your passcode is your password.
{% endhint %}

<figure><img src="/files/zIFF4COCjwamBEFQADq9" alt=""><figcaption></figcaption></figure>

| Field/Option          | Overview                                                                                                                                                                                          |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Repository URL        | Enter the repository URL. If you have enabled Authentication above the credentials will be used to access the repository. The below options will be populated by what is found in the repository. |
| Skip TLS verification | Toggle this on to skip the verification of TLS certificates used by your repository. This is useful if your repo uses a self-signed certificate.                                                  |
| Repository reference  | Select the reference to use when deploying the stack (for example, the branch).                                                                                                                   |
| Manifest path         | Enter the path to the manifest file from the root of the repository.                                                                                                                              |
| GitOps updates        | Toggle this on to enable GitOps updates (see below).                                                                                                                                              |

<figure><img src="/files/ymZlhbrBA9sDopzjNI3M" alt=""><figcaption></figcaption></figure>

#### GitOps updates

{% hint style="info" %}
This feature is only available in [Portainer Business Edition](https://www.portainer.io/business-upsell?from=ca-file).
{% endhint %}

Portainer supports automatically updating your Edge Stacks deployed from Git repositories. To enable this, toggle on **GitOps updates** and configure your settings.

{% hint style="info" %}
For more detail on how automatic updates function under the hood, have a look at [this FAQ](/sts/faqs/troubleshooting/stacks-deployments-and-updates/how-do-automatic-updates-for-stacks-applications-work.md).
{% endhint %}

| Field/Option   | Overview                                                                                                                                                                                                                                                                                                                                      |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Mechanism      | <p>Select the method to use when checking for updates:</p><p><strong>Polling:</strong> Periodically poll the Git repository from Portainer to check for updates to the repository.</p><p><strong>Webhook:</strong> Generate a webhook URL to add to your Git repository to trigger the update on demand (for example via GitHub actions).</p> |
| Fetch interval | If **Polling** is selected, how often Portainer will check the Git repository for updates.                                                                                                                                                                                                                                                    |
| Webhook        | When **Webhook** is selected, displays the webhook URL to use in your integration. Click **Copy link** to copy the webhook URL to the clipboard.                                                                                                                                                                                              |

<figure><img src="/files/xz3jP4OwOGBZNqGS5ar7" alt=""><figcaption><p>GitOps updates when using polling</p></figcaption></figure>

<figure><img src="/files/ranVgH4CJo8mpSpkVPvx" alt=""><figcaption><p>GitOps updates when using webhooks</p></figcaption></figure>

|                    |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Re-pull image      | When enabled, Portainer checks for an updated image when a redeploy is triggered via webhook or polling. It uses the tag you configured; if no tag is set, or you set `latest`, it uses `latest`. If that tag now points to a new image, Portainer pulls it and redeploys the workload.                                                                                                                                                                                                                                                                     |
| Force redeployment | <p>Enable this setting to force the redeployment of your stack at the specified interval (or when the webhook is triggered), overwriting any changes that have been made in the local environment, even if there has been no update to the stack in Git. This is useful if you want to ensure that your Git repository is the source of truth for your stacks and are happy with the local stack being replaced.</p><p>If this option is left disabled, automatic updates will only trigger if Portainer detects a change in the remote Git repository.</p> |

<figure><img src="/files/ijQfuVll1UMZdpGy6gXq" alt=""><figcaption></figcaption></figure>

## Additional settings

### Webhooks

{% hint style="info" %}
This feature is only available in [Portainer Business Edition](https://www.portainer.io/business-upsell?from=ca-file).
{% endhint %}

For the Web editor and Upload build methods you can choose to enable an Edge Stack webhook. This webhook will allow you to trigger updates to the stack by sending a POST request to a specific URL, instructing Portainer to pull the most up to date version of the associated image and re-deploy the stack.

{% hint style="info" %}
For Git deployed stacks, this functionality is available via [GitOps updates](#gitops-updates).
{% endhint %}

<figure><img src="/files/ouIRNwQUvtiXqTDINoQ9" alt=""><figcaption></figcaption></figure>

### Registry

{% hint style="info" %}
This feature is only available in [Portainer Business Edition](https://www.portainer.io/business-upsell?from=ca-file).
{% endhint %}

If your stack requires access to images in private registries, you can specify which registry to use as part of the deployment.

<figure><img src="/files/o2qZFwSUvN0uq1txaEI8" alt=""><figcaption></figcaption></figure>

### Update configurations

{% hint style="info" %}
This feature is only available in [Portainer Business Edition](https://www.portainer.io/business-upsell?from=ca-file).
{% endhint %}

This section lets you define the method in which your stack updates are deployed across your Edge devices. You can choose to deploy to **All edge devices at once**, or select **Parallel edge device(s)** to specify how many devices to update concurrently.

{% hint style="warning" %}
These settings do **not** apply to the *initial* provision of your Edge Stack. These only apply to the process that will occur when your stack is updated *after* deployment.
{% endhint %}

<figure><img src="/files/H0NsxuFGYfXKMtJj3wmR" alt=""><figcaption></figcaption></figure>

If **Parallel edge device(s)** is selected, you can choose to either deploy in static group sizes or in an exponential rollout strategy. For static group sizes, choose the **Number of device(s)** option and specify your group size.

<figure><img src="/files/9quMWM9QeykOy0C7UWZa" alt=""><figcaption></figcaption></figure>

For an exponential rollout, choose the **Exponential rollout** option and specify how many devices to start with, then select the multiplier to apply to the initial size. For example, selecting a start size of 5 and a multiplier of 2, stack updates would be rolled out to 5 devices, then 10 (5 x 2), then 20 (10 x 2), and so forth.

<figure><img src="/files/dGWtWoAmT5ODQ6pCGmNR" alt=""><figcaption></figcaption></figure>

When using parallel rollouts, you can also specify the **Timeout** (in minutes) before Portainer considers the update to have failed, as well as the **Update delay** (in minutes) between each group of updates are applied.

In addition, you can define the **Update failure action** that will be taken if the update fails:

* **Continue** will move on to the next group of devices to update.
* **Pause** will halt the update process but will keep the update applied to any devices that have already been deployed to.
* **Rollback** will halt the update process and roll back the update on devices already updated.

<figure><img src="/files/WQnglNEDXeyhennB1wCa" alt=""><figcaption></figcaption></figure>

Once the configuration is completed, click **Deploy the stack**.


---

# 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.portainer.io/sts/user/edge/stacks/add/kubernetes-deployment.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.
