[docs] - Improve docs for google_container_{node_pool,cluster} (#1155)

* [docs] - Improve docs for google_container_{node_pool,cluster}

* node pool examples formatting
This commit is contained in:
Bob 2018-03-08 18:08:14 +01:00 committed by Dana Hoffman
parent 46fb949c1f
commit f3691675a4
2 changed files with 58 additions and 15 deletions

View File

@ -94,11 +94,14 @@ output "cluster_ca_certificate" {
* `enable_legacy_abac` - (Optional) Whether the ABAC authorizer is enabled for this cluster. * `enable_legacy_abac` - (Optional) Whether the ABAC authorizer is enabled for this cluster.
When enabled, identities in the system, including service accounts, nodes, and controllers, When enabled, identities in the system, including service accounts, nodes, and controllers,
will have statically granted permissions beyond those provided by the RBAC configuration or IAM. will have statically granted permissions beyond those provided by the RBAC configuration or IAM.
Defaults to `true`
* `initial_node_count` - (Optional) The number of nodes to create in this * `initial_node_count` - (Optional) The number of nodes to create in this
cluster (not including the Kubernetes master). Must be set if `node_pool` is not set. cluster (not including the Kubernetes master). Must be set if `node_pool` is not set.
* `ip_allocation_policy` - (Optional) Configuration for cluster IP allocation. As of now, only pre-allocated subnetworks (custom type with secondary ranges) are supported. * `ip_allocation_policy` - (Optional) Configuration for cluster IP allocation. As of now, only pre-allocated subnetworks (custom type with secondary ranges) are supported.
This will activate IP aliases. See the [official documentation](https://cloud.google.com/kubernetes-engine/docs/how-to/ip-aliases)
Structure is documented below.
* `logging_service` - (Optional) The logging service that the cluster should * `logging_service` - (Optional) The logging service that the cluster should
write logs to. Available options include `logging.googleapis.com` and write logs to. Available options include `logging.googleapis.com` and
@ -121,7 +124,10 @@ output "cluster_ca_certificate" {
official release (which is not necessarily the latest version). official release (which is not necessarily the latest version).
* `monitoring_service` - (Optional) The monitoring service that the cluster * `monitoring_service` - (Optional) The monitoring service that the cluster
should write metrics to. Available options include should write metrics to.
Automatically send metrics from pods in the cluster to the Google Cloud Monitoring API.
VM metrics will be collected by Google Compute Engine regardless of this setting
Available options include
`monitoring.googleapis.com` and `none`. Defaults to `monitoring.googleapis.com` and `none`. Defaults to
`monitoring.googleapis.com` `monitoring.googleapis.com`
@ -152,9 +158,10 @@ The `addons_config` block supports:
* `horizontal_pod_autoscaling` - (Optional) The status of the Horizontal Pod Autoscaling * `horizontal_pod_autoscaling` - (Optional) The status of the Horizontal Pod Autoscaling
addon, which increases or decreases the number of replica pods a replication controller addon, which increases or decreases the number of replica pods a replication controller
has based on the resource usage of the existing pods. It is enabled by default; has based on the resource usage of the existing pods.
set `disabled = true` to disable. It ensures that a Heapster pod is running in the cluster, which is also used by the Cloud Monitoring service.
It is enabled by default;
set `disabled = true` to disable.
* `http_load_balancing` - (Optional) The status of the HTTP (L7) load balancing * `http_load_balancing` - (Optional) The status of the HTTP (L7) load balancing
controller addon, which makes it easy to set up HTTP load balancers for services in a controller addon, which makes it easy to set up HTTP load balancers for services in a
cluster. It is enabled by default; set `disabled = true` to disable. cluster. It is enabled by default; set `disabled = true` to disable.

View File

@ -14,13 +14,13 @@ and
[API](https://cloud.google.com/container-engine/reference/rest/v1/projects.zones.clusters.nodePools). [API](https://cloud.google.com/container-engine/reference/rest/v1/projects.zones.clusters.nodePools).
## Example usage ## Example usage
### Standard usage
```hcl ```hcl
resource "google_container_node_pool" "np" { resource "google_container_node_pool" "np" {
name = "my-node-pool" name = "my-node-pool"
zone = "us-central1-a" zone = "us-central1-a"
cluster = "${google_container_cluster.primary.name}" cluster = "${google_container_cluster.primary.name}"
initial_node_count = 3 node_count = 3
} }
resource "google_container_cluster" "primary" { resource "google_container_cluster" "primary" {
@ -45,14 +45,50 @@ resource "google_container_cluster" "primary" {
"https://www.googleapis.com/auth/logging.write", "https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring", "https://www.googleapis.com/auth/monitoring",
] ]
guest_accelerator = [{
type="nvidia-tesla-k80" guest_accelerator {
count=1 type = "nvidia-tesla-k80"
}] count = 1
}
} }
} }
```
```
### Usage with an empty default pool.
```hcl
resource "google_container_node_pool" "np" {
name = "my-node-pool"
zone = "us-central1-a"
cluster = "${google_container_cluster.primary.name}"
node_count = 1
node_config {
preemptible = true
machine_type = "n1-standard-1"
oauth_scopes = [
"compute-rw",
"storage-ro",
"logging-write",
"monitoring",
]
}
}
resource "google_container_cluster" "primary" {
name = "marcellus-wallace"
zone = "us-central1-a"
lifecycle {
ignore_changes = ["node_pool"]
}
node_pool {
name = "default-pool"
}
}
```
## Argument Reference ## Argument Reference
* `zone` - (Required) The zone in which the cluster resides. * `zone` - (Required) The zone in which the cluster resides.