Use Terraform and the SAS IaC tools to create a Kubernetes cluster for your SAS Viya deployment.
When using the Terraform CLI, make sure you have all the necessary tools installed on your workstation.
Follow either one of the authentication methods described in Authenticating Terraform to Access AWS and set all the environment variables using the export
command.
TIP: These commands can be stored in a directory outside of this repository in a secure file, for example in
$HOME/.aws_creds.sh
. Protect that file so that only you have Read access to it. Then source your credentials into your shell environment:
. $HOME/.aws_creds.sh
Prepare your terraform.tfvars
file, as described in Customize Input Values.
Initialize the Terraform environment for this project by running the following command:
terraform init
This creates a .terraform
directory locally and initializes the Terraform plug-ins and modules that are used in this project.
NOTE: The
terraform init
command only needs to be run once unless new Terraform plug-ins and modules are added.
To preview the resources that the Terraform script will create, run the following command:
terraform plan
To create cloud resources, run the following command:
terraform apply
This command can take a few minutes to complete. Once it has completed, Terraform output values are written to the console. The kubeconfig
file for the cluster is written to [prefix]-eks-kubeconfig.conf
in the current directory, $(pwd)
.
Once the cloud resources have been created using the terraform apply
command, Terraform output values can be displayed again later at any time by running the following command:
terraform output
After provisioning the infrastructure, you can make additional changes by modifying terraform.tfvars
and running terrafom apply
again.
To destroy all the cloud resources created with the previous commands, run the following command:
terraform destroy
NOTE: The
destroy
action is irreversible.
Creating the cloud resources writes the kube_config
output value to a file, ./[prefix]-eks-kubeconfig.conf.
When the Kubernetes cluster is ready, use kubectl
to interact with the cluster.
NOTE: The value for cluster_endpoint_public_access_cidrs
in CONFIG-VARS.md must be set to your local IP address or CIDR range.
export KUBECONFIG=$(pwd)/<your prefix>-eks-kubeconfig.conf
kubectl get nodes