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

Private cluster #22

Merged
merged 10 commits into from
Apr 10, 2019
Merged

Private cluster #22

merged 10 commits into from
Apr 10, 2019

Conversation

autero1
Copy link
Contributor

@autero1 autero1 commented Apr 9, 2019

This PR adds support for GKE private clusters.

@autero1
Copy link
Contributor Author

autero1 commented Apr 9, 2019

Based on the initial push none of the existing examples broke

Copy link
Contributor

@robmorgan robmorgan left a comment

Choose a reason for hiding this comment

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

Looking good @autero1

examples/gke-private-cluster/main.tf Outdated Show resolved Hide resolved
subnetwork = "${google_compute_subnetwork.main.self_link}"

# When creating a private cluster, the 'master_ipv4_cidr_block' has to be defined and the size must be /28
master_ipv4_cidr_block = "10.5.0.0/28"
Copy link
Contributor

Choose a reason for hiding this comment

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

any point parameterizing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was thinking that also. The other examples use hardcoded values, so I went with that. Maybe parameterize with those values as defaults?

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay understood, wondering if we should do this now or ship as is. If we change, we should change all examples

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd be tempted to create pre_launch branch and PR we all work on. Some of the items include

  • README updates
  • Code documentation (comments and section within modules and examples)
  • Use VPC module
  • Optionally adding a deployment step in one one of the examples + exposing the service

examples/gke-private-cluster/main.tf Outdated Show resolved Hide resolved

If you want your cluster nodes to be able to access the Internet, for example pull images from external container registries,
you will have to set up [Cloud NAT](https://cloud.google.com/nat/docs/overview).
See [Example GKE Setup](https://cloud.google.com/nat/docs/gke-example) for further information.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe one day we could include an example for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe our VPC module has Cloud NAT. Other option could be showcasing running one of Google's containers (gcloud container images list --project google-containers). I tested the private cluster with gcr.io/google-containers/nginx and exposed that with a load balancer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Checked the module, and the NAT is only for the public subnet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

# DEPLOY A GKE CLUSTER
# This module deploys a GKE cluster, a managed, production-ready environment for deploying containerized applications.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice 👍

Copy link
Contributor

@yorinasub17 yorinasub17 left a comment

Choose a reason for hiding this comment

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

LGTM. A few nits in documentation and API, but they are minor.

examples/gke-private-cluster/main.tf Outdated Show resolved Hide resolved
description = "${var.cluster_service_account_description}"
}

# TODO(rileykarson): Add proper VPC network config once we've made a VPC module
Copy link
Contributor

Choose a reason for hiding this comment

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

@rileykarson Is this still valid? I thought v0.0.1 has everything necessary, or am I missing something?

Copy link
Contributor

Choose a reason for hiding this comment

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

@yorinasub17 nope, no longer valid. We should use @rileykarson 's module. Another thing on my pre-launch list.

region as your private cluster, can use the private endpoint.

* **Public endpoint:** This is the external IP address of the master. You can disable access to the public endpoint by setting
`enable_private_endpoint` to `true`.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is slightly confusing. E.g enable_private_endpoint signals to me that this only controls the private endpoint, treating the public endpoint separately.

Should this be disable_public_endpoint instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you're right... using disable_public_endpoint feels more intuitive.

Reason for naming it like this is because gcloud uses --enable-private-endpoint. On the other hand the web console uses "Access master using its external IP address" -checkbox. 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And terraform provider uses enable_private_endpoint 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense. I am a bit on the fence about deviating from the google APIs, but I do feel that disable_public_endpoint is the better name...

@autero1 autero1 changed the title [WIP:] Private cluster Private cluster Apr 10, 2019
@autero1 autero1 merged commit eda8942 into master Apr 10, 2019
@autero1 autero1 deleted the private_cluster branch April 10, 2019 13:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants