Skip to content

isaaguilar/infrakube-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Infrakube CLI [ik]

A CLI tool to aid in discovering Infrakube managed pods and running debug sessions

Installation

Binary files will be created when the cli is released

Requires golang 1.24

You can manually build the project by:

  1. Download the repo https://github.com/isaaguilar/infrakube-cli
  2. Run the go build command
git clone https://github.com/isaaguilar/infrakube-cli.git
cd infrakube-cli
go build -o ik main.go
mv ik /usr/local/bin

Usage

Run ik help for all options.

ik local debug

Opens a debug session.

ik local debug <tf-resource-name>

Example:

kubectl apply --namespace default -f - << EOF
apiVersion: tf.isaaguilar.com/v1alpha2
kind: Terraform
metadata:
  name: stable
spec:
  terraformModule:
    source: https://github.com/isaaguilar/simple-aws-tf-modules.git//create_file
  backend: |-
    terraform {
      backend "kubernetes" {
        secret_suffix    = "stable"
        in_cluster_config  = true
      }
    }
  ignoreDelete: false
EOF

Output should look like:

terraform.tf.isaaguilar.com/stable configured

Then run a debug pod:

ik local debug --namespace default stable

This command will create a pod on the cluster using the tf resource for configuration. The pod puts the user in the terraform module.

Connecting to stable-2huxns3o-v3-debug-xhhtg.....

Try running 'terraform init'

/home/i3-runner/generations/3/main$

Finally, debug and exit.

/home/i3-runner/generations/3/main$ terraform plan
null_resource.write_file: Refreshing state... [id=2066474016391370391]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

/home/i3-runner/generations/3/main$ exit
exit

Notice the debug pod terminates as soon as the user exits.

kubectl get po | grep stable-2huxns3o-v3-debug-xhhtg
stable-2huxns3o-v3-debug-xhhtg                 1/1     Terminating   0          4m20s

About

A CLI for working with terraform-operator resources

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •