This Grafana-agent-k8s Terraform module aims to deploy the grafana-agent-k8s charm via Terraform.
The following software and tools needs to be installed and should be running in the local environment.
microk8s
juju 3.x
terrafom
Install Microk8s:
sudo snap install microk8s --channel=1.27-strict/stable
sudo usermod -a -G snap_microk8s $USER
newgrp snap_microk8s
Enable storage
plugin for Microk8s:
sudo microk8s enable hostpath-storage
Install Juju:
sudo snap install juju --channel=3.1/stable
Install Terraform:
sudo snap install --classic terraform
Bootstrap Juju Controller:
juju bootstrap microk8s
Add a Juju model:
juju add model <model-name>
Initialise the provider:
terraform init
Customize the configuration inputs under terraform.tfvars
file according to requirement. Make sure that given model-name
exists.
Sample contents of terraform.tfvars
file:
model_name =<fill here>
metrics_remote_write_offer_url =<fill here>
logging_offer_url =<fill here>
Run Terraform Plan by providing var-file:
terraform plan -var-file="terraform.tfvars"
Deploy the resources, skip the approval
terraform apply -auto-approve
Run juju switch <juju model>
to switch to the target Juju model and observe the status of the application.
juju status
The output should be similar to the following. The charm is blocked until the relations are joined.
Model Controller Cloud/Region Version SLA Timestamp
test microk8s-localhost microk8s/localhost 3.1.7 unsupported 15:57:12+03:00
App Version Status Scale Charm Channel Rev Address Exposed Message
grafana-agent-k8s 0.32.1 waiting 1 grafana-agent-k8s latest/stable 51 10.152.183.195 no installing agent
Unit Workload Agent Address Ports Message
grafana-agent-k8s/0* blocked idle 10.1.146.47 Missing incoming ('requires') relation
Remove the application:
terraform destroy -auto-approve