Add a new custom template
Creating the template
From the menu select Custom Templates then click Add Custom Template.
![](https://docs.portainer.io/~gitbook/image?url=https%3A%2F%2F3146734376-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FwXVC6tYZrbL0dPoO2iBb%252Fuploads%252F8JKGooAjV1IWuKSpxBBZ%252F2.15-k8s_kubernetes_add_custom_templates.gif%3Falt%3Dmedia%26token%3Dff0d671a-c62d-4e04-9e07-0812440f475d&width=768&dpr=4&quality=100&sign=a0e61368&sv=1)
Complete the form, using the table below as a guide.
Field/Option | Overview |
---|---|
Title | Enter a title for your custom template. This is how the template will appear when it's deployed. |
Description | Enter a description of the template. |
Note | As an optional step, record some extra information about the template. |
Icon URL | Optionally, enter the URL to an image to use as an icon for the template. |
![](https://docs.portainer.io/~gitbook/image?url=https%3A%2F%2F3146734376-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FwXVC6tYZrbL0dPoO2iBb%252Fuploads%252FFEivav16Y2WRONMuhDwQ%252F2.15-kubernetes_create_custom_template.png%3Falt%3Dmedia%26token%3D0d82c273-f068-44ae-9d39-a8a8fe1a4a88&width=768&dpr=4&quality=100&sign=640e562b&sv=1)
Next, select the Build method.
Selecting the build method
Method 1: Web editor
Define or paste the contents of your manifest file into the web editor. When deploying an application using a custom template you will be given an opportunity to edit the manifest before deployment.
You can search within the web editor at any time by pressing Ctrl-F
(or Cmd-F
on Mac).
![](https://docs.portainer.io/~gitbook/image?url=https%3A%2F%2F3146734376-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FwXVC6tYZrbL0dPoO2iBb%252Fuploads%252FvonCuPRdAPUcspyOwGla%252F2.15-kubernetes_custom_template_web_editor.png%3Falt%3Dmedia%26token%3D24068747-08e2-4eaa-b645-0c7513f1a9c3&width=768&dpr=4&quality=100&sign=8c3b2551&sv=1)
When you're ready, click Create custom template.
Method 2: Upload
If you have a manifest file locally, you can upload it directly to Portainer. Click Select file to browse to the file.
![](https://docs.portainer.io/~gitbook/image?url=https%3A%2F%2F3146734376-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FwXVC6tYZrbL0dPoO2iBb%252Fuploads%252Fo3IRjg5JKElWOqTq6hvn%252F2.15-kubernetes_custom_template_upload.png%3Falt%3Dmedia%26token%3D07b3d4d8-7310-437e-8495-080a38ab8c42&width=768&dpr=4&quality=100&sign=5a7de166&sv=1)
When you're ready, click Create custom template.
Variables in templates
Custom templates support the use of variables to provide further customization of the deployed stack. A stack can define a variable that can then be adjusted by the user at deployment.
This feature is only available in Portainer Business Edition.
Variables are identified in stacks with {{ }}
. For example, the following stack provides a REPLICA_COUNT
variable:
![](https://docs.portainer.io/~gitbook/image?url=https%3A%2F%2F3146734376-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FwXVC6tYZrbL0dPoO2iBb%252Fuploads%252Ff06pJ8JvlVJb2JvPBHh1%252F2.15-kubernetes_custom_template_web_editor_variables.png%3Falt%3Dmedia%26token%3D060e5ae2-ffee-48f7-be64-721d40789ccd&width=768&dpr=4&quality=100&sign=a698d5d1&sv=1)
When a variable is defined, options appear to customize how the variable appears when deploying the stack. You can set the label, description and default value.
When a template is deployed, any variables that have been configured are editable:
![](https://docs.portainer.io/~gitbook/image?url=https%3A%2F%2F3146734376-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FwXVC6tYZrbL0dPoO2iBb%252Fuploads%252FFQdA9iDkuymyx7te1r6r%252F2.15-kubernetes_custom_template_saved_variables.png%3Falt%3Dmedia%26token%3D2367d774-3b51-4332-87c8-0454e0b7df62&width=768&dpr=4&quality=100&sign=fead6c09&sv=1)
Last updated