This module registers a Kubernetes cluster in an Anthos Environ.
Specifically, this module automates the following steps for registering a cluster
There is GKE full example and a Generic K8s example provided. Simple usage is as follows:
module "hub" {
source = "terraform-google-modules/kubernetes-engine/google//modules/hub"
project_id = "my-project-id"
cluster_name = "my-cluster-name"
location = module.gke.location
cluster_endpoint = module.gke.endpoint
}
To deploy this config:
- Run
terraform apply
- Anthos Environs require an active Anthos license.
Name | Description | Type | Default | Required |
---|---|---|---|---|
cluster_endpoint | The GKE cluster endpoint. | string |
n/a | yes |
cluster_name | The unique name to identify the cluster in ASM. | string |
n/a | yes |
enable_gke_hub_registration | Enables GKE Hub Registration when set to true | bool |
true |
no |
gcloud_sdk_version | The gcloud sdk version to use. Minimum required version is 293.0.0 | string |
"296.0.1" |
no |
gke_hub_membership_name | Membership name that uniquely represents the cluster being registered on the Hub | string |
"gke-hub-membership" |
no |
gke_hub_sa_name | Name for the GKE Hub SA stored as a secret creds-gcp in the gke-connect namespace. |
string |
"gke-hub-sa" |
no |
labels | Comma separated labels in the format name=value to apply to cluster in the GCP Console. | string |
"" |
no |
location | The location (zone or region) this cluster has been created in. | string |
n/a | yes |
module_depends_on | List of modules or resources this module depends on. | list |
[] |
no |
project_id | The project in which the resource belongs. | string |
n/a | yes |
sa_private_key | Private key for service account base64 encoded. Required only if use_existing_sa is set to true . |
string |
null |
no |
use_existing_sa | Uses an existing service account to register membership. Requires sa_private_key | bool |
false |
no |
use_kubeconfig | Use existing kubeconfig to register membership. Set this to true for non GKE clusters. Assumes kubectl context is set to cluster to register. | bool |
false |
no |
use_tf_google_credentials_env_var | Optional GOOGLE_CREDENTIALS environment variable to be activated. | bool |
false |
no |
Name | Description |
---|---|
wait | An output to use when you want to depend on registration finishing |