This repository contains terraform definitions for 6 clusters that are used in the aperture science demo Codefresh account.
All 6 clusters are virtual (see vcluster.com)
The clusters are split into 2 groups
These are kc-v-prod
,kc-v-qa
,kc-v-staging
, kc-v-dev
These clusters are
- connected as managed clusters to
gitops
runtime - are externally accessible the full DNS names
- can only be used for deploying applications
These are prod-vcluster
,qa-vcluster
,staging-vcluster
These clusters:
- contain one GitOps runtime each
- are NOT externally accessible
- can be used for deploying applications and running Argo Workflows
Download to your workstation the aws cli and the vcluster cli.
Get your AWS credential from the AWS SSO application in your Codefresh account
Then in a terminal execute:
aws eks --region us-east-1 update-kubeconfig --name kubecon-dev
You now have access to the parent/real cluster that contains all the virtual clusters.
To access individual clusters from group A
Execute
vcluster connect target-vcluster-prod -n target-vcluster-prod --server=https://prod.kubecon.sales-dev.codefresh.io
vcluster connect target-vcluster-qa -n target-vcluster-qa --server=https://qa.kubecon.sales-dev.codefresh.io
vcluster connect target-vcluster-staging -n target-vcluster-staging --server=https://staging.kubecon.sales-dev.codefresh.io
vcluster connect target-vcluster-dev -n target-vcluster-dev --server=https://dev.kubecon.sales-dev.codefresh.io
Note that each command will permanently change your local kubeconfig file to that of the virtual cluster. Use the command vcluster disconnect
to change your kubecontext back to the parent/real cluster.
To access individual clusters from group B, execute:
vcluster connect qa-vcluster -n vcluster-qa
vcluster connect prod-vcluster -n vcluster-prod
vcluster connect staging-vcluster -n vcluster-staging
vcluster connect dev-vcluster -n vcluster-dev
Note that each command will start a port forward process. You need then to open another terminal to use kubectl
commands to access the cluster. Press Ctrl-C to change your kubecontext back to the parent/real cluster.
To destroy all the clusters first install the terraform CLI and run
terraform init
terraform destroy
Before doing that you might want to disconnect the deployment clusters from Codefresh first and uninstall also the GitOps runtimes.
If you want to create the clusters again
terraform init
terraform apply
Answer yes to the question.
Notice that in both cases we use the parent/real cluster for holding the terraform state, so you need to have run the aws cli command first.