Skip to content

Commit

Permalink
[terraform] Add dynanamic cluster name. Add consistent nodepool label…
Browse files Browse the repository at this point in the history
…ing. PR#791

Closes: aptos-labs#791
  • Loading branch information
Ivan Morozov authored and aptos-bot committed May 4, 2022
1 parent 2415fd6 commit 411c688
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
26 changes: 18 additions & 8 deletions terraform/fullnode/vultr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,46 @@ The default configuration will create a single node cluster with 4CPU/8GB and a

$ cd aptos-core/terraform/fullnode/vultr

3. Change the cluster Name in `cluster.tf`
3. Create a working directory for your configuration. Copy the files you will change so it does not interfere with the cloned repo:

4. Configure cluster properties in `variables.tf`.
* Choose a workspace name e.g. `devnet`. Note: this defines terraform workspace name, which in turn is used to form resource names.

$ export WORKSPACE=devnet

* Create a directory for the workspace

$ mkdir -p ~/$WORKSPACE

4. Change the cluster Name in `cluster.tf`

5. Configure cluster properties in `variables.tf`.

The most important variable is `api_key`, make sure you use the API key obtained in step 1. It will create a 1 machine with 4CPU/8GB in Frankfurt per default.

5. Apply the configuration with (it might take a while)
6. Apply the configuration with (it might take a while)

$ terraform apply

6. Configure your Kubernetes client:
7. Configure your Kubernetes client:

Log in your VULTR account. Go to Products -> Kubernetes. Press the 3 dots on the right side and choose "Manage".
Press Download Configuration, it will download a YAML containing the access config to your cluster.

$ export KUBECONFIG=~/vke...yaml

7. Check that your fullnode pods are now running (this may take a few minutes):
8. Check that your fullnode pods are now running (this may take a few minutes):

$ kubectl get pods -n aptos

8. Get your fullnode IP:
9. Get your fullnode IP:

$ kubectl get svc -o custom-columns=IP:status.loadBalancer.ingress -n aptos

9. Check REST API, make sure the ledge version is increasing.
10. Check REST API, make sure the ledge version is increasing.

$ curl http://<IP>

10. To verify the correctness of your FullNode, as outlined in the documentation (https://aptos.dev/tutorials/run-a-fullnode/#verify-the-correctness-of-your-fullnode), you will need to set up a port-forwarding mechanism directly to the aptos pod in one ssh terminal and test it in another ssh terminal
11. To verify the correctness of your FullNode, as outlined in the documentation (https://aptos.dev/tutorials/run-a-fullnode/#verify-the-correctness-of-your-fullnode), you will need to set up a port-forwarding mechanism directly to the aptos pod in one ssh terminal and test it in another ssh terminal

* Set up the port-forwarding to the aptos-fullnode pod. Use `kubectl get pods -n aptos` to get the name of the pod

Expand Down
2 changes: 1 addition & 1 deletion terraform/fullnode/vultr/cluster.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "vultr_kubernetes" "k8" {
region = var.fullnode_region
label = "aptos-devnet"
label = "aptos-${terraform.workspace}"
version = "v1.23.5+3"

node_pools {
Expand Down
2 changes: 1 addition & 1 deletion terraform/fullnode/vultr/kubernetes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ resource "helm_release" "fullnode" {
tag = var.image_tag
}
nodeSelector = {
"vke.vultr.com/node-pool" = "node"
"vke.vultr.com/node-pool" = "aptos-fullnode"
}
storage = {
class = kubernetes_storage_class.ssd.metadata[0].name
Expand Down

0 comments on commit 411c688

Please sign in to comment.