Skip to main content
Boost your DevOps efficiency! Dive into our latest white paper.Read Now

Tutorial: Deploying Nginx with Kapstan

This tutorial offers a practical, hands-on approach to deploying a docker Nginx image on your AWS EKS cluster using Kapstan. It will take you through each step required to deploy an Nginx image. Here are the list of steps we will follow:

  1. Login and Create Tenant
  2. Environment Setup
  3. Infrastructure Provisioning
  4. Deploy Nginx
  5. See It in Action

Login

  1. Log into your Kapstan account. Create an Organization or join in an existing one by an invite.

Environment Setup

Once connection creation is successful, we proceed with the Environment creation.

  1. Click on "Create Environment", under the recommended next steps. Alternatively, click here to create a new environment. Read more about managing environments here.
  2. Provide the following information:
  • Environment Name: Give it a unique name; e.g. nginx-tutorial.
  • Environment Type: Choose desired type between Staging and Production environment.
  • Connection: Choose the cloud provider connection you've set up.
  • Region: Select the geographical region for your deployment.
  • Account Type: Decide if you want to deploy resources in the main connected account or in a sub-account. If you opt for a sub-account, Kapstan will create a sub-account within your main account. You'll need to specify an email address for the sub-account owner.

Once you provide the above information, click on "Create" to create the new environment.

Infrastructure Provisioning

In order to deploy our Nginx application we need a Kubernetes Cluster, in order to create a Kubernetes Cluster we need a Virtual Network.

Create Virtual Network

  1. Navigate to the Infrastructure Overview on Kapstan.
  2. Click on "Create infrastructure" and then on "Virtual Network".
  3. Alternatively, you can also click here to create a new virtual network. It will create a new virtual network in your environment.
  4. To provision a new virtual network, provide the following information:
  • Virtual network name: Specify a unique name for your network; e.g. nginx-tutorial.

Create Kubernetes Cluster

  1. Navigate to the Infrastructure Overview on Kapstan.
  2. Click on "Create infrastructure" and then on "Kubernetes Cluster".
  3. Alternatively, you can also click here to create a new Kubernetes Cluster. It will create a new Kubernetes Cluster in your environment.
  4. To provision a new Kubernetes Cluster, provide the following information:
  • Cluster Name Enter a unique name for your cluster. This will be used to identify your cluster within the Kapstan interface. E.g., prod_demo.
  • Virtual Network From the dropdown menu, select the Virtual Network which you created in the last section.

Deploy Nginx

Create Application

  1. Navigate to the Applications on Kapstan.
  2. Open create application menu and select 'Container'.
  3. Fill in the following details:
  • Display Name: Provide a name for your custom application. e.g. nginx-app.
  • Cluster: Select the Kubernetes Cluster which you just created from the dropdown.
  1. Choose Public Repository in "Container registry" and fill nginx in the "Public repository URL".
  2. Select a desired image tag.
  3. Submit the form and the application will be created.

Deploy Container in your Application

  1. In the Application overview page click on the Unapplied changes if any and confirm the configurations.
  2. Select Deploy button to deploy the application.

See It in Action

  1. Install kubectl
  2. Install awscli
  3. Configure AWS Profile with AccessKeyID and SecretAccessKey used while creating a kapstan cloudprovider connection
  4. Set the kubectl context to use AWS cluster
aws eks update-kubeconfig --region us-west-2 --name prod_demo
  1. Get the pods in Nginx namespace
~ » kubectl get pods -n nginx-server -o json | jq -r '.items[0].metadata.name'
nginx-server-c5d594f7c-4rjlp
  1. Copy the pod name and proceed with port forwarding. Port forward Nginx port to local. kubectl port-forward <pod-name> 9000:8080

Port Forward 7. Open localhost:9000 in your browser.

Access localhost

Can't find what you need?