GCP-GKE-Pulumi-py

GCP-GKE-Pulumi-py

GCP GKE PULUMI PLATFORM SETUP

The GCP-GKE-Pulumi-Py infrastructure as code lets you deploy infrastructure over GCP using the Pulumi Python language framework.

Create Secret from Settings

Secrets are encrypted environment variables that CTO.ai utilizes within your workflow to build and run your application and deployments.

Create Token on Pulumi

Sign up and log in to Pulumi to create your token. In your Pulumi dashboard, create an organization and give it a name.

  • Click on the Settings tab and select Access Tokens. Create an Access Token for youro deployment.

GCP GKE Pulumi Py Demo

The GCP GKE Pulumi stack is a complete IaC for deploying infrastructure over GCP: Kubernetes, Container Registry, Database Clusters, Load Balancers, and Project Resource Management all built using Python + Pulumi + CTO.ai.

Build Pipelines locally with the CTO.ai CLI

  • In your terminal, enter the ops build . command and select the sample-app-gcr-pipeline. This ops build . command will build your op for sharing, your Docker image from your Docker file, and the set of files located in the specified path you created in your source code.
  • When the image is built, it’s going to create an image ID, and successfully tag it in your CTO.ai console.

Run and set up your Infrastructure

Next, you need to build and set up the infrastructure that will deploy each resource to GCP using the Pulumi Python framework. Set up your infrastructure using ops run -b . This will provision your stack using Pulumi

  • select setup Infrastructure over GCP
  • The process will build your Docker image and start loading up your GCP-GKE Stack
  • Select the environment to deploy to. In this guide, we are working with the dev environment.
  • Select the service(s) to deploy, in this guide we will select all
  • Install the dependencies
  • Your workflow will start deploying and creating your resources on GCP using Pulumi
  • You can also see the ouput dirctly in your terminal

View Resources in Pulumi

While your resources are deploying on the terminal you can click on the view/preview link on your terminal, it will redirect you to view the resources directly on Pulumi

With this, you can see all the changes and activity when creating your resources, and how each configuration is deployed.

  • You can also explore your Pulumi dashboard to see the changes made

View Resources on GCP

Back in your GCP Console, you can see that your resources are created.

  • Your PostgreSQL 11 database instance is created
  • You can also see the overview of your DB instance with the chart configuration
  • Your Kubernetes Cluster is also ready for usage
  • View the VM instances for your GKE Cluster
  • When you Click on it, you can see the Machine configuration and Network configs
  • You can also see the traffic of your GCP resources