Warning: This method of installation is not supported at the time of writing. I've documented my findings here in case it might benefit anyone in the future.
- Install Terraform: https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli
- Provision a Kubernetes cluster on your preferred platform. This will be your upstream cluster for installing Opni. For example, https://ranchermanager.docs.rancher.com/pages-for-subheaders/deploy-rancher-manager
- Provision any additional downstream clusters to monitor. The Opni Agent will be installed in these clusters.
- Read the Opni installation guide for "Installation with Helm" > "Chart Configuration" section. Create your own
values.yaml
and fill out the fields for the Opnigateway
. You do not need theopni-agent
oropni-prometheus-crd
fields. https://opni.io/installation/opni/ - Clone this repo and go to the upstream opni installation directory:
cd terraform-install-opni/opni
- Set the
config_path
to your upstream cluster kubeconfig path, eg~/.kube/config
. You will also need to set the kubeconfig in your terminal:export KUBECONFIG=~/.kube/config
# terraform-install-opni/opni/main.tf
provider "kubernetes" {
config_path = "~/.kube/config"
}
- Paste your
values.yaml
file from step 2 into theopni
directory - Add the Opni Helm repo
helm repo add opni https://raw.githubusercontent.com/rancher/opni/charts-repo
helm repo update
- Run
terraform init
,terraform plan
to see the proposed changes to your cluster. - Run
terraform apply
. This will installcert-manager
, the Opni CRDs and Opni. It may take a few minutes to complete. - Follow the rest of the documentation to install Opni backends and other features: https://opni.io/installation/opni/
To upgrade Opni, change the "version" number of your upstream opni installation, eg "0.9.2" to "0.10.0" and run terraform apply
- Go to the
terraform-install-opni/opni-agent
directory in this repository:cd ../opni-agent
- Fill out the
values.yaml
file in this repo for the agent configuration. Refer to the Opni documentation for more info. - Using the same steps as above, set the
config_path
to your downstream cluster kubeconfig path, egexport KUBECONFIG=~/.kube/downstream-config
# terraform-install-opni/opni-agent/main.tf
provider "kubernetes" {
config_path = "~/.kube/downstream-config"
}
- Run
terraform init
,terraform plan
to see the proposed changes to your cluster. - Run
terraform apply
. This will installcert-manager
, the Opni CRDs and the Opni agent. - Repeat the above steps for each of your downstream clusters.
- Follow the rest of the documentation to learn how to use Opni: https://opni.io/installation/opni/
Opni Wiki for additional documentation: https://github.com/rancher/opni/wiki
Opni Github: https://github.com/rancher/opni
Helm Provider Docs: https://registry.terraform.io/providers/hashicorp/helm/latest/docs
Alternative methods for k8s authentication: https://registry.terraform.io/providers/hashicorp/helm/latest/docs#authentication
Tutorial to Deploy Helm Charts with Terraform Module: https://www.bootiq.io/en/deploy-helm-charts-using-terraform-module/