Skip to content

This repository contains terraform code that deploys drone

Notifications You must be signed in to change notification settings

mathplusyou/tf-drone-deployment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Drone Deployment

This repository outlines the steps needed to deploy drone with helm on an eks cluster. The cluster and load balancer sitting in front of the drone service will be provisioned with terraform.

Table of Contents

  1. EKS Cluster Deployment Pre-reqs
  2. Deploying an EKS Cluster with Terraform
  3. Installing/Configuring Helm
  4. Deploying Drone with Helm

EKS Cluster Deployment Pre-reqs

There are some things we'll need to do before we can deploy an EKS cluster with terraform.

1. Clone this Repo

2. Install Terraform

Install terraform by following the documentation outlined here.

NOTE: It's better to download the binary for a specific version of terraform. Certain terraform configurations require a specific versions of terraform. You can manage different versions of terraform with a tool like stow.

3. Configure the Terraform AWS Provider

This step assumes you have an AWS account already. Learn how to configure the terraform aws provider here.

4. EKS Module pre-reqs

The terraform eks module is being used to deploy our eks cluster. The eks module requires that the following software be installed on your system before it can be used:

  1. Kubectl : Installation Instructions
  2. AWS IAM Authenticator : Installation Instructions

5.Configuring the Terraform Backend

  1. Edit the bucket used for remote state in main.tf

NOTE: For demo purposes, keeping your terraform state local is fine.

EKS Cluster Deployment

cdinto the terraform directory and run the following commands:

  1. terraform init
  2. terraform plan
  3. terraform apply

Installing and Configuring Helm

1. Configuring kubectl

After the terraform apply is finished, a kubeconfig file kubeconfig_<env>-<workspace>-cluster will be generated in the terraform directory. We need to set the apppropriate context, so that the kubectl client will be able to interact with the eks cluster we spun up. Follow the steps outlined below to configure kubectl:

  1. Run export KUBECONFIG=/full/path/to/kubeconfig_<env>-<workspace>-cluster

2. Creating a Service Account and Cluster Role Bindings for Tiller

Now that we've configured kubectl, we can create kubernetes resources that Helm needs.

  1. cd into the k8s directory.
  2. Run kubectl create -f rbac-config.yaml

This command will create a Service Account and Cluser Role Binding for Tiller that will allow it to deploy kubernetes resources.

3. Installing Helm

Follow the steps outlined in this here to install helm on your workstation. Tiller will be installed after the eks cluster is deployed.

4. Install Tiller on the EKS Cluster

The following steps outline the installation of tiller on our EKS cluster:

  1. Run export KUBE_CONFIG=/full/path/to/kubeconfig_<env>-<workspace>-cluster
  2. Run helm init

Deploying Drone with Helm

  1. cd into the helm directory.
  2. Populate values.yaml file with the necessary information.
  3. Run helm install --name drone -f values.yaml stable/demo

Accessing Drone

  1. cd into the terraform directory and run terraform outputs. This will return the hostname of the elastic load balancer.
  2. Drone should now be accessible via the load balancer hostname.
  3. Create a CNAME so you can access drone at the URL we specified earlier.

Danke!

About

This repository contains terraform code that deploys drone

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages