Skip to content

Commit 3ba3559

Browse files
authored
chore: Relocate docs on private clusters to central location (#552)
* Add doc about priate clusters * Remove file structure from README * Move private cluster notes to doc.
1 parent 65981e4 commit 3ba3559

File tree

12 files changed

+64
-183
lines changed

12 files changed

+64
-183
lines changed

README.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -243,20 +243,6 @@ In order to operate with the Service Account you must activate the following API
243243
- Compute Engine API - compute.googleapis.com
244244
- Kubernetes Engine API - container.googleapis.com
245245

246-
## File structure
247-
The project has the following folders and files:
248-
249-
- /: root folder
250-
- /examples: Examples for using this module and sub module.
251-
- /helpers: Helper scripts.
252-
- /scripts: Scripts for specific tasks on module (see Infrastructure section on this file).
253-
- /test: Folders with files for testing the module (see Testing section on this file).
254-
- /main.tf: `main` file for the public module, contains all the resources to create.
255-
- /variables.tf: Variables for the public cluster module.
256-
- /output.tf: The outputs for the public cluster module.
257-
- /README.MD: This file.
258-
- /modules: Private and beta sub modules.
259-
260246
[terraform-provider-google]: https://github.com/terraform-providers/terraform-provider-google
261247
[3.0.0]: https://registry.terraform.io/modules/terraform-google-modules/kubernetes-engine/google/3.0.0
262248
[terraform-0.12-upgrade]: https://www.terraform.io/upgrade-guides/0-12.html

autogen/main/README.md

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,8 @@ The resources/services/activations/deletions that this module will create/trigge
1212
Sub modules are provided from creating private clusters, beta private clusters, and beta public clusters as well. Beta sub modules allow for the use of various GKE beta features. See the modules directory for the various sub modules.
1313

1414
{% if private_cluster %}
15-
## Private Cluster Endpoints
16-
When creating a [private cluster](https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters), nodes are provisioned with private IPs.
17-
The Kubernetes master endpoint is also [locked down](https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters#access_to_the_cluster_endpoints), which affects these module features:
18-
- `configure_ip_masq`
19-
- `stub_domains`
20-
21-
If you are *not* using these features, then the module will function normally for private clusters and no special configuration is needed.
22-
If you are using these features with a private cluster, you will need to either:
23-
1. Run Terraform from a VM on the same VPC as your cluster (allowing it to connect to the private endpoint) and set `deploy_using_private_endpoint` to `true`.
24-
2. Enable (beta) [route export functionality](https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters#master-on-prem-routing) to connect from an on-premise network over a VPN or Interconnect.
25-
3. Include the external IP of your Terraform deployer in the `master_authorized_networks` configuration.
26-
4. Deploy a [bastion host](https://github.com/terraform-google-modules/terraform-google-bastion-host) or [proxy](https://cloud.google.com/solutions/creating-kubernetes-engine-private-clusters-with-net-proxies) in the same VPC as your GKE cluster.
27-
28-
If you are going to isolate your GKE private clusters from internet access you could check [guide](https://medium.com/google-cloud/completely-private-gke-clusters-with-no-internet-connectivity-945fffae1ccd) and [repo](https://github.com/andreyk-code/no-inet-gke-cluster)
15+
## Private Cluster Details
16+
For details on configuring private clusters with this module, check the [troubleshooting guide](../../docs/private_clusters.md).
2917

3018
{% endif %}
3119
{% if update_variant %}
@@ -258,20 +246,6 @@ In order to operate with the Service Account you must activate the following API
258246
- Compute Engine API - compute.googleapis.com
259247
- Kubernetes Engine API - container.googleapis.com
260248

261-
## File structure
262-
The project has the following folders and files:
263-
264-
- /: root folder
265-
- /examples: Examples for using this module and sub module.
266-
- /helpers: Helper scripts.
267-
- /scripts: Scripts for specific tasks on module (see Infrastructure section on this file).
268-
- /test: Folders with files for testing the module (see Testing section on this file).
269-
- /main.tf: `main` file for the public module, contains all the resources to create.
270-
- /variables.tf: Variables for the public cluster module.
271-
- /output.tf: The outputs for the public cluster module.
272-
- /README.MD: This file.
273-
- /modules: Private and beta sub modules.
274-
275249
{% if beta_cluster %}
276250
[terraform-provider-google-beta]: https://github.com/terraform-providers/terraform-provider-google-beta
277251
{% else %}

docs/private_clusters.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Creating Private GKE Clusters
2+
3+
To create a private GKE cluster, you can use one of the [private submodules](../modules).
4+
5+
Note that a private cluster is inherently more restricted and greater care must be taken in configuring networking ingress/egress.
6+
7+
## Private Cluster Endpoints
8+
When creating a [private cluster](https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters), nodes are provisioned with private IPs.
9+
The Kubernetes master endpoint is also [locked down](https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters#access_to_the_cluster_endpoints), which affects these module features:
10+
- `configure_ip_masq`
11+
- `stub_domains`
12+
13+
If you are *not* using these features, then the module will function normally for private clusters and no special configuration is needed.
14+
15+
If you are using these features with a private cluster, you will need to either:
16+
1. Run Terraform from a VM on the same VPC as your cluster (allowing it to connect to the private endpoint) and set `deploy_using_private_endpoint` to `true`.
17+
2. Enable (beta) [route export functionality](https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters#master-on-prem-routing) to connect from an on-premise network over a VPN or Interconnect.
18+
3. Include the external IP of your Terraform deployer in the `master_authorized_networks` configuration.
19+
4. Deploy a [bastion host](https://github.com/terraform-google-modules/terraform-google-bastion-host) or [proxy](https://cloud.google.com/solutions/creating-kubernetes-engine-private-clusters-with-net-proxies) in the same VPC as your GKE cluster.
20+
21+
If you are going to isolate your GKE private clusters from internet access you could check [this guide](https://medium.com/google-cloud/completely-private-gke-clusters-with-no-internet-connectivity-945fffae1ccd) and the associated [repo](https://github.com/andreyk-code/no-inet-gke-cluster).
22+
23+
## Troubleshooting
24+
25+
### Master Authorized Network
26+
When creating a private cluster with a [private endpoint](https://cloud.google.com/kubernetes-engine/docs/how-to/authorized-networks#benefits_with_private_clusters) (`enable_private_endpoint = true`),
27+
your cluster will **not** have a publicly addressable endpoint.
28+
29+
When using this setting, any CIDR ranges listed in the `master_authorized_networks` configuration *must* come from your private IP space.
30+
If you include a CIDR block outside your private space, you might see this error:
31+
32+
```
33+
Error: Error waiting for creating GKE cluster: Invalid master authorized networks: network "73.89.231.174/32" is not a reserved network, which is required for private endpoints.
34+
35+
on .terraform/modules/gke-cluster-dev.gke/terraform-google-kubernetes-engine-9.2.0/modules/beta-private-cluster/cluster.tf line 22, in resource "google_container_cluster" "primary":
36+
22: resource "google_container_cluster" "primary" {
37+
```
38+
39+
To resolve this error, update your configuration to either:
40+
41+
* Enable a public endpoint (with `enable_private_endpoint = false`)
42+
* Update your `master_authorized_networks` configuration to only use CIDR blocks from your private IP space.

modules/beta-private-cluster-update-variant/README.md

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,8 @@ The resources/services/activations/deletions that this module will create/trigge
1010

1111
Sub modules are provided from creating private clusters, beta private clusters, and beta public clusters as well. Beta sub modules allow for the use of various GKE beta features. See the modules directory for the various sub modules.
1212

13-
## Private Cluster Endpoints
14-
When creating a [private cluster](https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters), nodes are provisioned with private IPs.
15-
The Kubernetes master endpoint is also [locked down](https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters#access_to_the_cluster_endpoints), which affects these module features:
16-
- `configure_ip_masq`
17-
- `stub_domains`
18-
19-
If you are *not* using these features, then the module will function normally for private clusters and no special configuration is needed.
20-
If you are using these features with a private cluster, you will need to either:
21-
1. Run Terraform from a VM on the same VPC as your cluster (allowing it to connect to the private endpoint) and set `deploy_using_private_endpoint` to `true`.
22-
2. Enable (beta) [route export functionality](https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters#master-on-prem-routing) to connect from an on-premise network over a VPN or Interconnect.
23-
3. Include the external IP of your Terraform deployer in the `master_authorized_networks` configuration.
24-
4. Deploy a [bastion host](https://github.com/terraform-google-modules/terraform-google-bastion-host) or [proxy](https://cloud.google.com/solutions/creating-kubernetes-engine-private-clusters-with-net-proxies) in the same VPC as your GKE cluster.
25-
26-
If you are going to isolate your GKE private clusters from internet access you could check [guide](https://medium.com/google-cloud/completely-private-gke-clusters-with-no-internet-connectivity-945fffae1ccd) and [repo](https://github.com/andreyk-code/no-inet-gke-cluster)
13+
## Private Cluster Details
14+
For details on configuring private clusters with this module, check the [troubleshooting guide](../../docs/private_clusters.md).
2715

2816
## Node Pool Update Variant
2917

@@ -345,20 +333,6 @@ In order to operate with the Service Account you must activate the following API
345333
- Compute Engine API - compute.googleapis.com
346334
- Kubernetes Engine API - container.googleapis.com
347335

348-
## File structure
349-
The project has the following folders and files:
350-
351-
- /: root folder
352-
- /examples: Examples for using this module and sub module.
353-
- /helpers: Helper scripts.
354-
- /scripts: Scripts for specific tasks on module (see Infrastructure section on this file).
355-
- /test: Folders with files for testing the module (see Testing section on this file).
356-
- /main.tf: `main` file for the public module, contains all the resources to create.
357-
- /variables.tf: Variables for the public cluster module.
358-
- /output.tf: The outputs for the public cluster module.
359-
- /README.MD: This file.
360-
- /modules: Private and beta sub modules.
361-
362336
[terraform-provider-google-beta]: https://github.com/terraform-providers/terraform-provider-google-beta
363337
[3.0.0]: https://registry.terraform.io/modules/terraform-google-modules/kubernetes-engine/google/3.0.0
364338
[terraform-0.12-upgrade]: https://www.terraform.io/upgrade-guides/0-12.html

modules/beta-private-cluster/README.md

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,8 @@ The resources/services/activations/deletions that this module will create/trigge
1010

1111
Sub modules are provided from creating private clusters, beta private clusters, and beta public clusters as well. Beta sub modules allow for the use of various GKE beta features. See the modules directory for the various sub modules.
1212

13-
## Private Cluster Endpoints
14-
When creating a [private cluster](https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters), nodes are provisioned with private IPs.
15-
The Kubernetes master endpoint is also [locked down](https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters#access_to_the_cluster_endpoints), which affects these module features:
16-
- `configure_ip_masq`
17-
- `stub_domains`
18-
19-
If you are *not* using these features, then the module will function normally for private clusters and no special configuration is needed.
20-
If you are using these features with a private cluster, you will need to either:
21-
1. Run Terraform from a VM on the same VPC as your cluster (allowing it to connect to the private endpoint) and set `deploy_using_private_endpoint` to `true`.
22-
2. Enable (beta) [route export functionality](https://cloud.google.com/kubernetes-engine/docs/how-to/private-clusters#master-on-prem-routing) to connect from an on-premise network over a VPN or Interconnect.
23-
3. Include the external IP of your Terraform deployer in the `master_authorized_networks` configuration.
24-
4. Deploy a [bastion host](https://github.com/terraform-google-modules/terraform-google-bastion-host) or [proxy](https://cloud.google.com/solutions/creating-kubernetes-engine-private-clusters-with-net-proxies) in the same VPC as your GKE cluster.
25-
26-
If you are going to isolate your GKE private clusters from internet access you could check [guide](https://medium.com/google-cloud/completely-private-gke-clusters-with-no-internet-connectivity-945fffae1ccd) and [repo](https://github.com/andreyk-code/no-inet-gke-cluster)
13+
## Private Cluster Details
14+
For details on configuring private clusters with this module, check the [troubleshooting guide](../../docs/private_clusters.md).
2715

2816
## Compatibility
2917

@@ -323,20 +311,6 @@ In order to operate with the Service Account you must activate the following API
323311
- Compute Engine API - compute.googleapis.com
324312
- Kubernetes Engine API - container.googleapis.com
325313

326-
## File structure
327-
The project has the following folders and files:
328-
329-
- /: root folder
330-
- /examples: Examples for using this module and sub module.
331-
- /helpers: Helper scripts.
332-
- /scripts: Scripts for specific tasks on module (see Infrastructure section on this file).
333-
- /test: Folders with files for testing the module (see Testing section on this file).
334-
- /main.tf: `main` file for the public module, contains all the resources to create.
335-
- /variables.tf: Variables for the public cluster module.
336-
- /output.tf: The outputs for the public cluster module.
337-
- /README.MD: This file.
338-
- /modules: Private and beta sub modules.
339-
340314
[terraform-provider-google-beta]: https://github.com/terraform-providers/terraform-provider-google-beta
341315
[3.0.0]: https://registry.terraform.io/modules/terraform-google-modules/kubernetes-engine/google/3.0.0
342316
[terraform-0.12-upgrade]: https://www.terraform.io/upgrade-guides/0-12.html

modules/beta-public-cluster-update-variant/README.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ Then perform the following commands on the root folder:
146146
| cluster\_autoscaling | Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling) | object | `<map>` | no |
147147
| cluster\_ipv4\_cidr | The IP address range of the kubernetes pods in this cluster. Default is an automatically assigned CIDR. | string | `"null"` | no |
148148
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | map(string) | `<map>` | no |
149+
| config\_connector | (Beta) Whether ConfigConnector is enabled for this cluster. | bool | `"false"` | no |
149150
| configure\_ip\_masq | Enables the installation of ip masquerading, which is usually no longer required when using aliasied IP addresses. IP masquerading uses a kubectl call, so when you have a private cluster, you will need access to the API server. | string | `"false"` | no |
150151
| create\_service\_account | Defines if service account specified to run nodes should be created. | bool | `"true"` | no |
151152
| database\_encryption | Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: "ENCRYPTED"; "DECRYPTED". key_name is the name of a CloudKMS key. | object | `<list>` | no |
@@ -320,20 +321,6 @@ In order to operate with the Service Account you must activate the following API
320321
- Compute Engine API - compute.googleapis.com
321322
- Kubernetes Engine API - container.googleapis.com
322323

323-
## File structure
324-
The project has the following folders and files:
325-
326-
- /: root folder
327-
- /examples: Examples for using this module and sub module.
328-
- /helpers: Helper scripts.
329-
- /scripts: Scripts for specific tasks on module (see Infrastructure section on this file).
330-
- /test: Folders with files for testing the module (see Testing section on this file).
331-
- /main.tf: `main` file for the public module, contains all the resources to create.
332-
- /variables.tf: Variables for the public cluster module.
333-
- /output.tf: The outputs for the public cluster module.
334-
- /README.MD: This file.
335-
- /modules: Private and beta sub modules.
336-
337324
[terraform-provider-google-beta]: https://github.com/terraform-providers/terraform-provider-google-beta
338325
[3.0.0]: https://registry.terraform.io/modules/terraform-google-modules/kubernetes-engine/google/3.0.0
339326
[terraform-0.12-upgrade]: https://www.terraform.io/upgrade-guides/0-12.html

modules/beta-public-cluster-update-variant/cluster.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ resource "google_container_cluster" "primary" {
149149
kalm_config {
150150
enabled = var.kalm_config
151151
}
152+
153+
config_connector_config {
154+
enabled = var.config_connector
155+
}
152156
}
153157

154158
ip_allocation_policy {

modules/beta-public-cluster-update-variant/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,12 @@ variable "kalm_config" {
398398
default = false
399399
}
400400

401+
variable "config_connector" {
402+
type = bool
403+
description = "(Beta) Whether ConfigConnector is enabled for this cluster."
404+
default = false
405+
}
406+
401407
variable "database_encryption" {
402408
description = "Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: \"ENCRYPTED\"; \"DECRYPTED\". key_name is the name of a CloudKMS key."
403409
type = list(object({ state = string, key_name = string }))

modules/beta-public-cluster-update-variant/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ terraform {
1818
required_version = "~> 0.12.6"
1919

2020
required_providers {
21-
google-beta = ">= 3.21.0, <4.0.0"
21+
google-beta = ">= 3.23.0, <4.0.0"
2222
}
2323
}

modules/beta-public-cluster/README.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -299,20 +299,6 @@ In order to operate with the Service Account you must activate the following API
299299
- Compute Engine API - compute.googleapis.com
300300
- Kubernetes Engine API - container.googleapis.com
301301

302-
## File structure
303-
The project has the following folders and files:
304-
305-
- /: root folder
306-
- /examples: Examples for using this module and sub module.
307-
- /helpers: Helper scripts.
308-
- /scripts: Scripts for specific tasks on module (see Infrastructure section on this file).
309-
- /test: Folders with files for testing the module (see Testing section on this file).
310-
- /main.tf: `main` file for the public module, contains all the resources to create.
311-
- /variables.tf: Variables for the public cluster module.
312-
- /output.tf: The outputs for the public cluster module.
313-
- /README.MD: This file.
314-
- /modules: Private and beta sub modules.
315-
316302
[terraform-provider-google-beta]: https://github.com/terraform-providers/terraform-provider-google-beta
317303
[3.0.0]: https://registry.terraform.io/modules/terraform-google-modules/kubernetes-engine/google/3.0.0
318304
[terraform-0.12-upgrade]: https://www.terraform.io/upgrade-guides/0-12.html

0 commit comments

Comments
 (0)