cluster management
- Manages a kubernetes cluster using kops
Prerequisites
Install terraform
From here
Learn CDK for terraform
From here
Learn features of GCP
- IAM,role and permissions from here.
- Service accounts from here.
Service account key file for running terraform
- Create a custom role from IAM and Admin section.
- The role should have the following permissions
- Create a GCP
service account
.
- Assign the above role to the service account.
- Download the json formatted service account key and use it to run
cdktf
scripts.
- It is recommended to rename the downloaded json file and rename it to something understable.
- All of the
cdktf
scripts can pick up the service account file
by passing it through [-c|--credentials]
command line option.
Running commands
The scripts are kept in the src/deploy
folder of this repository. The two commands
yarn synth
and yarn deploy
will be used to run those scripts.
Deploy with CDK
yarn synth -a "tsx src/main.ts --pi <google cloud project id>
yarn deploy vm-instance k0s-cluster -a `tsx src/main.ts --pi <google cloud project id>
The deploy
command do run synth
, however it is easier to verify the command
by the synth
separately.