Difference between revisions of "Deploy GKE cluster using Terraform"
Jump to navigation
Jump to search
(27 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | * https://github.com/hashicorp/learn-terraform-provision-gke-cluster | ||
+ | Resources: | ||
+ | + resource "[[google_compute_network]]" "vpc" { | ||
+ | + resource "[[google_compute_subnetwork]]" "subnet" { | ||
+ | + resource "[[google_container_cluster]]" "primary" { | ||
+ | + resource "[[google_container_node_pool]]" "primary_nodes" { | ||
+ | == Execution == | ||
+ | [[git clone]] https://github.com/hashicorp/learn-terraform-provision-gke-cluster | ||
+ | cd learn-terraform-provision-gke-cluster | ||
+ | [[terraform init]] | ||
+ | Change <code>[[project_id]]</code> in <code>[[terraform.tfvar]]</code> file with name of your cluster. (See: <code>[[gcloud projects create]]</code>) | ||
− | [[ | + | == Terraform plan (GKE) == |
− | + | [[terraform plan (GKE using Terraform) 2022|terraform plan (GKE)]] (2022) | |
+ | [[terraform plan (GKE using Terraform) 2023|terraform plan (GKE)]] (Dec 2023) | ||
− | [[terraform plan (GKE | + | [[terraform plan (GKE) Error: Error retrieving available container cluster versions]] |
[[terraform plan]] | grep -w resource | [[terraform plan]] | grep -w resource | ||
Line 13: | Line 25: | ||
+ resource "[[google_container_node_pool]]" "primary_nodes" { | + resource "[[google_container_node_pool]]" "primary_nodes" { | ||
+ | == Terraform apply == | ||
[[terraform apply]] | [[terraform apply]] | ||
.../... | .../... | ||
Line 24: | Line 37: | ||
region = "us-central1" | region = "us-central1" | ||
+ | Configure credentials to connect: | ||
+ | [[gcloud container clusters get-credentials $(terraform output -raw kubernetes_cluster_name) --region $(terraform output -raw region)]] | ||
− | [[ | + | [[k get pod -A (Terraform GKE)|kubectl get pod -A]] |
− | [[ | + | |
+ | [[Error: error creating NodePool]] .../... [[ Error 403: Insufficient regional quota to satisfy]] | ||
== Related == | == Related == | ||
Line 34: | Line 50: | ||
* <code>[[gke.tf]]</code> | * <code>[[gke.tf]]</code> | ||
* <code>[[Unable to connect to the server]]</code> | * <code>[[Unable to connect to the server]]</code> | ||
+ | * <code>[[gcp_filestore_csi_driver_config]]</code> | ||
+ | * [[Deploy GKE cluster using Terraform: variables.tf]] | ||
+ | * <code>[[google_compute_network.vpc]]</code> | ||
+ | * <code>[[brew install --cask google-cloud-sdk]]</code> | ||
+ | * <code>[[gcloud auth application-default login]]</code> | ||
+ | * <code>[[gcloud init]]</code> | ||
+ | * [[Kubernetes Engine API]] | ||
== See als == | == See als == | ||
+ | * {{gke.tf}} | ||
* {{tf GKE}} | * {{tf GKE}} | ||
* {{GKE}} | * {{GKE}} | ||
[[Category:GKE]] | [[Category:GKE]] |
Latest revision as of 17:17, 7 December 2023
Resources:
+ resource "google_compute_network" "vpc" { + resource "google_compute_subnetwork" "subnet" { + resource "google_container_cluster" "primary" { + resource "google_container_node_pool" "primary_nodes" {
Execution[edit]
git clone https://github.com/hashicorp/learn-terraform-provision-gke-cluster cd learn-terraform-provision-gke-cluster terraform init
Change project_id
in terraform.tfvar
file with name of your cluster. (See: gcloud projects create
)
Terraform plan (GKE)[edit]
terraform plan (GKE) (2022) terraform plan (GKE) (Dec 2023)
terraform plan (GKE) Error: Error retrieving available container cluster versions
terraform plan | grep -w resource + resource "google_compute_network" "vpc" { + resource "google_compute_subnetwork" "subnet" { + resource "google_container_cluster" "primary" { + resource "google_container_node_pool" "primary_nodes" {
Terraform apply[edit]
terraform apply .../... Apply complete! Resources: 4 added, 0 changed, 0 destroyed. Outputs: kubernetes_cluster_host = "22.27.74.22" kubernetes_cluster_name = "your-project-gke" project_id = "your-project" region = "us-central1"
Configure credentials to connect:
gcloud container clusters get-credentials $(terraform output -raw kubernetes_cluster_name) --region $(terraform output -raw region)
kubectl get pod -A
Error: error creating NodePool .../... Error 403: Insufficient regional quota to satisfy
Related[edit]
- Deploy EKS cluster using Terraform
terraform.tfvars
gke.tf
Unable to connect to the server
gcp_filestore_csi_driver_config
- Deploy GKE cluster using Terraform: variables.tf
google_compute_network.vpc
brew install --cask google-cloud-sdk
gcloud auth application-default login
gcloud init
- Kubernetes Engine API
See als[edit]
gke.tf
- Deploy GKE cluster using Terraform,
addons_config, gke.tf, google_container_cluster, google_container_node_pool
- GKE, GKE Autopilot,
gcloud container, gke-gcloud-auth-plugin
, GKE release channels, GKE Ingress, GCP Node logs, GCP Node logs severity Error, GKE roles, Provide access to GKE cluster, Deploy GKE cluster using Terraform,cluster_autoscaling, addons_config, GKE Node Pool
, node auto-provisioning
Advertising: