Skip to content

Latest commit

 

History

History
145 lines (106 loc) · 7.35 KB

File metadata and controls

145 lines (106 loc) · 7.35 KB

Provision GKE cluster(s) Using Terraform & Install Ondat

What is this?

  • A demonstration project that uses Terraform to provision Google Kubernetes Engine [GKE] cluster(s) and installs Ondat - a software-defined, cloud native storage platform for Kubernetes.
    • The goal of this project is to automate the process of creating, managing and destroying a GKE cluster with terraform. During the creation of a cluster, Ondat is installed using the kubectl-storageos plugin.

Resource Requirements

Dependencies

  • Required utilities to ensure that deployments are executed successfully.
    • terraform , gcloud , kubectl , kubectl-storageos

Supported Node Image Operating Systems

  • Tested on;
    • UBUNTU , UBUNTU_CONTAINERD

Environment Setup

Step 1 - gcloud Configuration

Step 2 - terraform Configuration

  • Ensure that the terraform CLI is installed on your local machine and is in your path.
  • Apple M1 users may get the following error message when they run terraform init on their machine.
 Error: Incompatible provider version
│
│ Provider registry.terraform.io/hashicorp/template v2.2.0 does not have a package available for your current platform, darwin_arm64.
│
│ Provider releases are separate from Terraform CLI releases, so not all providers are available for all platforms. Other versions of this provider may have different platforms supported.
╵
# clone the template provider repository.
$ git clone [email protected]:hashicorp/terraform-provider-template.git

# navigate into the directory.
$ cd terraform-provider-template/

# build the template provider from source (requires Golang to be installed).
$ go build

# make the generated binary executable.
$ chmod -v +x terraform-provider-template

# create the following directory and move the binary into `darwin_arm64/`.
$ mkdir -v ~/.terraform.d/plugins/registry.terraform.io/hashicorp/template/2.2.0/darwin_arm64/
$ mv -v terraform-provider-template ~/.terraform.d/plugins/registry.terraform.io/hashicorp/template/2.2.0/darwin_arm64/

# go back to the `terraform-gke-ondat-demo/` directory containing 
# the configuration files and initialise again.
$ terraform init

Step 3 - kubectl, kubectl-storageos & storageos Configuration

  • Ensure that the kubectl CLI is installed on your local machine and is in your path.
  • Ensure that the kubectl-storageos plugin CLI is installed on your local machine and is in your path.
  • Ensure that the storageos CLI is installed on your local machine and is in your path.

Quick-start & Usage

# clone the repository.
$ git clone [email protected]:hubvu/terraform-kubernetes-ondat-demo.git

# navigate into the `aks/` directory.
$ cd terraform-kubernetes-ondat-demo/gke/

# initialise the working directory containing the configuration files.
$ terraform init

# validate the configuration files in the working directory.
$ terraform validate

# create an execution plan first.
$ terraform plan

# execute the actions proposed in a plan and enter your PROJECT_ID.
$ terraform apply

# after the cluster has been provisioned, inspect the pods with 
# kubectl and the generated kubeconfig file.
$ export KUBECONFIG="${PWD}/kubeconfig-ondat-demo"

# or use `gcloud` to get the cluster credentials automatically added 
# to your `$HOME/.kube/config`.
$ gcloud container clusters get-credentials terraform-gke-cluster-ondat-demo --region="europe-west1"

$ kubectl get pods --all-namespaces

# destroy the environment created with terraform once you 
# are finished testing out GKE & Ondat.
$ terraform destroy

Using Ondat

Acknowledgements