GuidesAPI Reference
Log In
Guides

Managed Kubernetes Runtimes

The prodvana_managed_k8s_runtime resource links a Kubernetes Runtime with Prodvana and fully manages the Prodvana Agent lifecycle.

The agent will be installed as a Kubernetes deployment by this resource. After the initial agent installation, Prodvana will manage the agent lifecycle, including upgrades, outside of Terraform.

This resource will perform Kubernetes operations on your behalf, so it accepts Kubernetes authentication configuration options. For a full list of the supported configuration options, see the Terraform Provider Docs (they match the options offered by the Kubernetes Terraform Provider). Also, see the example section below.

🚧

Destroying/Deleting the prodvana_managed_k8s_runtime resource will unlink the cluster from Prodvana and remove the Prodvana Agent.

Common Examples

Linking a GCP GKE Cluster

There are many ways to pass Kubernetes authentication credentials to the prodvana_managed_runtime_resource. This example assumes you are creating your GKE cluster in Terraform, and have access to the master_auth ouputs provided by the google_container_cluster resource.

resource "google_container_cluster" "cluster" {
  name     = "my-gke-cluster"
  location = "us-central1"

  // <...configuration elided...>
}

data "google_client_config" "default" { }

resource "prodvana_managed_k8s_runtime" "example" {
  name = "my-k8s-runtime"
  agent_env = {
    "PROXY" = "http://localhost:8080"
  }

  host                   = google_container_cluster.cluster.endpoint
  cluster_ca_certificate = base64decode(google_container_cluster.cluster.master_auth.0.cluster_ca_certificate)
  token                  = data.aws_eks_cluster_auth.cluster.token
}

Import an Existing Linked Runtime

If you've already linked a Runtime to Prodvana manually, you can import it so the link is managed by Terraform by create a prodvana_managed_k8s_runtime resource block, ensuring the name field matches the existing runtime. You must also pass Kubernetes credentials for the linked cluster.

resource "prodvana_managed_k8s_runtime" "example" {
  name = "my-k8s-runtime"
  
  // <... Kubernetes Credentials ...>
}

Once you run terraform apply, this runtime link will now be managed by terraform. Deleting/Destroying this resource will unlink the cluster from Prodvana and remove the Prodvana Agent.