Resource Definitions

Driver

Capability

Resource Type

Agent

Using the Humanitec Agent

This section contains example Resource Definitions using the Humanitec Agent for connecting to GKE clusters.

  • gke-agent.yaml: uses a Cloud Account as well as the Humanitec Agent to access this private cluster. This format is for use with the Humanitec CLI.
  • gke-agent.tf: uses a Cloud Account as well as the Humanitec Agent to access this private cluster. This format is for use with the Humanitec Terraform provider

Resource Definitions


gke-agent.yaml (view on GitHub) :

# GKE private cluster. It is to be accessed via the Humanitec Agent
# It is using a Cloud Account with temporary credentials
apiVersion: entity.humanitec.io/v1b1
kind: Definition
metadata:
  id: gke-agent
entity:
  name: gke-agent
  type: k8s-cluster
  # The driver_account is referring to a Cloud Account configured in your Organization
  driver_account: gcp-temporary-creds
  driver_type: humanitec/k8s-cluster-gke
  driver_inputs:
    secrets:
      # Setting the URL for the Humanitec Agent
      agent_url: "${resources['agent#agent'].outputs.url}"
    values:
      loadbalancer: 35.10.10.10
      name: demo-123
      zone: europe-west2-a
      project_id: my-gcp-project


gke-agent.tf (view on GitHub) :

resource "humanitec_resource_definition" "gke-agent" {
  driver_type    = "humanitec/k8s-cluster-gke"
  id             = "gke-agent"
  name           = "gke-agent"
  type           = "k8s-cluster"
  driver_account = "gcp-temporary-creds"
  driver_inputs = {
    values_string = jsonencode({
      "loadbalancer" = "35.10.10.10"
      "name"         = "demo-123"
      "zone"         = "europe-west2-a"
      "project_id"   = "my-gcp-project"
    })
    secrets_string = jsonencode({
      "agent_url" = "$${resources['agent#agent'].outputs.url}"
    })
  }
}


Top