Add an Application from GitLab Edit on GitHub Request doc changes

Contributors ebarcott

Learn how to deploy an Application on your NetApp Kubernetes Services (NKS) cluster from a GitLab repository.

Requirements

  • An NKS account. If you don’t have one already, you can sign up for a free 30-day trial with no credit card required at https://nks.netapp.io.

  • A Project set up and configured on your NKS account.

  • An application in a GitLab repository.

  • An SSH key pair for use as the deploy key. IMPORTANT: Create this key pair without a passphrase. For instructions on how to create an SSH key pair, follow the instructions in this article.

  • An NKS cluster with Build Version: Classic.

  • To create this cluster, use the New (not Classic) NKS UI.

  • When you build the cluster, choose Classic as the Cluster Build Type in the Provider Configuration step, as shown:

Select Cluster Build "Classic

If you have problems getting your Application up and running, you may need to customize your Procfile. Learn more about using a Procfile.

Add the Application

The first step is to add the Application to your NKS account.

Select Solution Type

Click Projects then select the Project you want to use.

Select your Project

Click + Add Solution. Click Application as the Solution type.

Click Application Solution type

Select the Workspace, Cluster, and Project you want to use, then click Next.

Define Version Control

In this step you will set two items:

  • NKS: The Remote URL

  • GitLab: The Private Deploy Key

Remote URL

To get this URL, visit your project’s GitLab repository page and click the blue Clone button.

Note
You must use "Clone with SSH."
Clone with SSH

Click to copy the SSH URL. Paste this in to NKS as the Remote URL.

Add the Remote URL

Private Deploy Key

For this step you will need an SSH key pair. IMPORTANT: Create this key pair without a passphrase.

For more information on how to create an SSH key pair, see this article.

Use caution when copying the SSH key. For instructions on how to copy the SSH key, see this article.

  • Mac: Use pbcopy.

  • Linux: Use xclip.

  • Windows: Use Notepad. If you have Git BASH, use the clip command.

Paste the private key into the Private Deploy Key field on NKS. You will add the public key to GitLab in the next section.

Add your private key

Click Next to continue.

Configure Application

Set the application’s name, update strategy, and scaling. Click Next to continue.

Review and Confirm

Review and confirm all your settings. To change a setting, click the Edit button.

When you are sure that everything is correct, click Create to create the Solution. This creates your Solution and redirects you to the Application’s page.

Deploy and Update Code

Next, you will add configurations to your GitLab repository. To do this, you will give GitLab:

  • The Deploy Key. This is the public key you created.

  • The Payload URL (webhook) from NKS.

  • The Webhook Secret from NKS.

Add the Deploy Key

Go to the GitLab page for your repository and click Settings > Repository.

GitLab Settings

Click to expand Deploy keys.

  • Be sure to add the public (not private) SSH key.

  • You do not need to enable write access.

Click Add key to add your Deploy key.

Add the Webhook

From the GitLab page for your repository, click Settings > Integrations.

Return to the NKS application page, where you will find the Payload URL and Webhook Secret.

Deploy the code

Paste these in to the URL and Secret Token fields on GitLab.

  • Set the event(s) you want to trigger the webhook.

  • Enable SSL verification.

Click Add webhook to add the webhook.

Trigger the Webhook if Necessary

When you add your webhook, GitLab gives you a list of choices for events which trigger the webhook. By default, a repository push is the webhook trigger. If this is the case for your webhook, you will need to do a git push to trigger the webhook.

Check Your Application

At this point everything is configured, although it make take a few minutes for the deployment to complete. You can monitor the process on the Solution’s Metrics tab.

When the deployment is ready, you can view your application by visiting the ingress URL which NKS automatically created for your application.

Get your ingress URL