- Table of content
- Futurestack-2022-workshop
- Description
- Requirements
- Setup
- Validate and create Dashboard
How to optimize the size your k8s containers to reduce cost and improve performance, using New Relic
Similar to bare metal machines or VMs being too large for a given workload, a container can also be too large to address the resource requirements appropriately.
If a container is not large enough, the workload can suffer on the other hand, e.g. by being throttled or restarted.
The goal of this workshop is to understand how to detect such cases, and optimize the resources allocation.
- Terraform 1.0.0 or newer installed
- At least one k8s cluster with New Relic monitoring deployed, using version 1.23.0 or newer
- Your New Relic account ID to deploy the Dashboard
- Your New Relic region
- A personal New Relic API key
To configure the Dashboard to your needs, you have two options: Use a variables file or export environment variables.
All variables are explained in the variables.tf file.
The two variables you have to set are account_id and api_key. All other variables can be ommitted as they also come with defaults.
Copy the example.tfvars file and adjust the values to your needs:
cp example.tfvars terraform.tfvarsExport each of the variables as an environment variable by prefixing them with TF_VAR_, e.g. TF_VAR_account_id for the variable account_id:
export TF_VAR_account_id=123456Terraform needs to download the New Relic provider to be able to perform the required API calls on your behalf:
terraform initPerform a dry-run of your configuration change and review the planned changes:
terraform plan -out=tfplanIf the plan runs without errors and the planned changes are correct, apply the changes:
terraform apply tfplanThe above two steps can be repeated to apply any change made to the Dashboard, be that changes to the variables (terraform.tfvars or exported environment variables), or to the Dashboard itself (dashboard.tf).
A successfully executed planfile will print a Dashboard URL at the end of the prompt. The URL will redirect you to your Dashboard that you can now use to analyze your workloads.