Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Upgrade Examples and tests to use Helm 3 #88

Merged
merged 16 commits into from
Apr 10, 2020
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
defaults: &defaults
machine: true
environment:
GRUNTWORK_INSTALLER_VERSION: v0.0.21
GRUNTWORK_INSTALLER_VERSION: v0.0.23
TERRATEST_LOG_PARSER_VERSION: v0.13.13
KUBERGRUNT_VERSION: v0.3.9
HELM_VERSION: v2.11.0
MODULE_CI_VERSION: v0.13.3
TERRAFORM_VERSION: 0.12.7
HELM_VERSION: v3.1.2
MODULE_CI_VERSION: v0.18.4
TERRAFORM_VERSION: 0.12.20
TERRAGRUNT_VERSION: NONE
PACKER_VERSION: NONE
GOLANG_VERSION: 1.11.2
GOLANG_VERSION: 1.13.8
K8S_VERSION: v1.10.0
KUBECONFIG: /home/circleci/.kube/config

Expand All @@ -24,9 +23,8 @@ install_gruntwork_utils: &install_gruntwork_utils
--terraform-version ${TERRAFORM_VERSION} \
--terragrunt-version ${TERRAGRUNT_VERSION} \
--packer-version ${PACKER_VERSION} \
--use-go-dep \
--go-version ${GOLANG_VERSION} \
--go-src-path test
--go-src-path ./test/

install_helm_client: &install_helm_client
name: install helm client
Expand All @@ -45,16 +43,16 @@ jobs:
- checkout
- restore_cache:
keys:
- dep-v1-{{ checksum "test/Gopkg.lock" }}
- gomod-{{ checksum "test/go.sum" }}

# Install gruntwork utilities
- run:
<<: *install_gruntwork_utils

- save_cache:
key: dep-v1-{{ checksum "test/Gopkg.lock" }}
key: gomod-{{ checksum "test/go.sum" }}
paths:
- ./test/vendor
- $HOME/go/src/

# Fail the build if the pre-commit hooks don't pass. Note: if you run pre-commit install locally, these hooks will
# execute automatically every time before you commit, ensuring the build never fails at this step!
Expand Down Expand Up @@ -87,11 +85,6 @@ jobs:
- run:
<<: *install_helm_client

# Install kubergrunt
- run:
name: Install kubergrunt
command: gruntwork-install --binary-name "kubergrunt" --repo "https://github.com/gruntwork-io/kubergrunt" --tag "${KUBERGRUNT_VERSION}"

- run:
name: update gcloud
command: |
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ using [Google Kubernetes Engine (GKE)](https://cloud.google.com/kubernetes-engin

## Quickstart

If you want to quickly spin up a GKE Private Cluster with Tiller, you can run the example that is in the root of this
repo. Check out the [gke-private-tiller example documentation](https://github.com/gruntwork-io/terraform-google-gke/blob/master/examples/gke-private-tiller)
If you want to quickly spin up a GKE Public Cluster, you can run the example that is in the root of this
repo. Check out the [gke-basic-helm example documentation](https://github.com/gruntwork-io/terraform-google-gke/blob/master/examples/gke-basic-helm)
for instructions.

## What's in this repo

This repo has the following folder structure:

* [root](https://github.com/gruntwork-io/terraform-google-gke/tree/master): The root folder contains an example of how
to deploy a GKE Private Cluster with Tiller. See [gke-private-tiller](https://github.com/gruntwork-io/terraform-google-gke/blob/master/examples/gke-private-tiller)
to deploy a GKE Public Cluster with and an example chart with [Helm](https://helm.sh/). See [gke-basic-helm](https://github.com/gruntwork-io/terraform-google-gke/blob/master/examples/gke-basic-helm)
for the documentation.

* [modules](https://github.com/gruntwork-io/terraform-google-gke/tree/master/modules): This folder contains the
Expand Down
88 changes: 88 additions & 0 deletions examples/gke-basic-helm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# GKE Basic Helm Example
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome docs 👍


The root folder contains an example of how to deploy a GKE Public Cluster with an example chart
with [Helm](https://helm.sh/).

## Overview

In this guide we will walk through the steps necessary to get up and running with GKE and Helm. Here are the steps:

1. [Install the necessary tools](#installing-necessary-tools)
1. [Apply the Terraform code](#apply-the-terraform-code)
1. [Verify the Deployed Chart](#verify-the-deployed-chart)
1. [Destroy the Deployed Resources](#destroy-the-deployed-resources)

## Installing necessary tools

In addition to `terraform`, this example relies on `gcloud` and `kubectl` and `helm` tools to manage the cluster.

This means that your system needs to be configured to be able to find `terraform`, `gcloud`, `kubectl` and `helm`
client utilities on the system `PATH`. Here are the installation guides for each tool:

1. [`gcloud`](https://cloud.google.com/sdk/gcloud/)
1. [`kubectl`](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
1. [`terraform`](https://learn.hashicorp.com/terraform/getting-started/install.html)
1. [`helm`](https://docs.helm.sh/using_helm/#installing-helm) (Minimum version v3.0)

Make sure the binaries are discoverable in your `PATH` variable. See [this Stack Overflow
post](https://stackoverflow.com/questions/14637979/how-to-permanently-set-path-on-linux-unix) for instructions on
setting up your `PATH` on Unix, and [this
post](https://stackoverflow.com/questions/1618280/where-can-i-set-path-to-make-exe-on-windows) for instructions on
Windows.

## Apply the Terraform Code

Now that all the prerequisite tools are installed, we are ready to deploy the GKE cluster!

1. If you haven't already, clone this repo:
- `git clone https://github.com/gruntwork-io/terraform-google-gke.git`
1. Make sure you are in the `gke-basic-helm` example folder:
- `cd examples/gke-basic-helm`
1. Fill in the required variables in `variables.tf` based on your needs
1. Authenticate to GCP:
- `gcloud auth login`
- `gcloud auth application-default login`
1. Initialize terraform:
- `terraform init`
1. Check the terraform plan:
- `terraform plan`
1. Apply the terraform code:
- `terraform apply`

At the end of the `terraform apply`, you should now have a working GKE cluster and `kubectl` context configured.
So let's verify that in the next step!

## Verify the Deployed Chart

The example configures your `kubectl` context, so you can use `kubectl` and `helm` commands without further configuration.

To see the created resources, run the following commands:

```
❯ kubectl get deployments -n default
NAME READY UP-TO-DATE AVAILABLE AGE
nginx 1/1 1 1 92m

❯ kubectl get service -n default
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.2.0.1 <none> 443/TCP 113m
nginx LoadBalancer 10.2.5.84 34.77.188.186 80:31588/TCP,443:31332/TCP 99m

❯ kubectl get pods -n default
NAME READY STATUS RESTARTS AGE
nginx-57454964b8-l4w9w 1/1 Running 0 99m
```

If you wish to access the deployed service, you use the `kubectl port-forward` command to forward a local port to the deployed service:

```
❯ kubectl port-forward deployment/nginx 8080:8080 -n default
Forwarding from 127.0.0.1:8080 -> 8080
Forwarding from [::1]:8080 -> 8080
```

You can now access the deployed service by opening your web browser to `http://localhost:8080`.

## Destroy the deployed resources

To destroy all resources created by the example, just run `terraform destroy`.
147 changes: 0 additions & 147 deletions examples/gke-basic-tiller/README.md

This file was deleted.

Loading