Iferrum
Iferrum

Reputation: 19

Create a Kubernetes Cluster on GCP with CDKTF in Golang

I have a containerised Frontend App and another Backend App (also containerised) that I want to deploy to GCP. I found that deploying it to a Kubernetes cluster is a good way to go. I'd like some pointers on how to go about it.

P.S: I have to do it with IaC in Golang (CDKTF)

I haven't tried anything per say, I was wondering if there could be a list of ToDos and I could start working on them step by step, cos right now I am not even sure where to start.

Upvotes: 1

Views: 185

Answers (1)

Gang Chen
Gang Chen

Reputation: 545

In general, deploying containerized application to GCP Kubernetes environment involves the following steps:

  1. Provision the Kubernetes runtime (infrastructure ) - Google Kubernetes Engine (GKE).
  2. Configure the GKE runtime such as creating namespaces, setting up RBAC etc.
  3. Deploy applications (your frontend and backend apps)

You can certainly do the infrastructure provisioning (task #1) using CDKTF. Here is an example using TypeScript CDKTF. Golang is a supported language. You need to install the Go kubernetes provider: https://github.com/cdktf/cdktf-provider-kubernetes-go. (i.e run: cdktf provider add kubernetes). And you can perform most of the configuration task (Task #2) through CDKTF.

Application deployment is where you have multiple options:

  • Using GCP native tools like Cloud Build and Cloud Deploy
  • Using Helm/kubectl or other application deployment packaging tools
  • Using Terraform (CDKTF) to deploy applications

IMHO, application deployment should use the tool that aligns your overall DevOps CI/CD pipeline tools the best.

Upvotes: 1

Related Questions