Back Original

Forget CDK and AWS's insane costs. Pulumi and DigitalOcean to the rescue

This document provides a step-by-step guide on how to start and set up a Pulumi project and integrate it with the DigitalOcean CLI (doctl) for managing infrastructure on DigitalOcean.

Before you begin, ensure you have the following tools installed on your machine:

In our example we are using the typescript option

Follow the official Pulumi installation guide to install Pulumi on your system. You can verify the installation by running:

Step 2: Set Up a New Pulumi Project in case you need

mkdir my-pulumi-project
cd my-pulumi-project
pulumi new typescript

STEP 4: Generate doctl token on the API section on Digital Ocean

alt text

alt text

STEP 5: Export the token just generated:

    export DIGITALOCEAN_TOKEN="YOUR_TOKEN_HERE"

STEP 6: Authenticate doctl with your Digital Ocean token just generated

STEP 6.1: Authenticate with docker and digital ocean registry

 docker login -u "youruser" -p "yourtoken"  registry.digitalocean.com

STEP 7: Tag the image of your application:

docker tag YOUR_IMAGE registry.digitalocean.com/YOUR_REGISTRY/YOUR_IMAGE

STEP 8: Push your image to the Digital Ocean Doker Registry

docker push registry.digitalocean.com/YOUR_REGISTRY/YOUR_IMAGE

STEP 09: Go to the project infra repository and run the following commands to first create the cluster, make sure to have export the env for the digitlocean token e Kubeconfig path:

To make sure we are using the right cluster versions run:

doctl kubernetes options versions
 pulumi up
 doctl kubernetes cluster kubeconfig save the clusteName

STEP 10: Run the following command to see if the current cluster is the same you created:

    kubectl config current-context

STEP 11: run the following command to add this a secret to the cluster:

 kubectl create secret generic digitalocean-dns   --from-literal=access-token="yourtoken"  --namespace default

Step 12: After creating the cluster secret responsible to verify the DNS you can go to the service-infra repo and run: