gcp_container_cluster - Creates a GCP Cluster¶
New in version 2.6.
Synopsis¶
- A Google Container Engine cluster.
Requirements¶
The below requirements are needed on the host that executes this module.
- python >= 2.6
- requests >= 2.18.4
- google-auth >= 1.3.0
Parameters¶
Parameter | Choices/Defaults | Comments | ||
---|---|---|---|---|
addons_config |
Configurations for the various addons available to run in the cluster.
|
|||
http_load_balancing |
Configuration for the HTTP (L7) load balancing controller addon, which makes it easy to set up HTTP load balancers for services in a cluster.
|
|||
disabled
bool |
|
Whether the HTTP Load Balancing controller is enabled in the cluster. When enabled, it runs a small pod in the cluster that manages the load balancers.
|
||
horizontal_pod_autoscaling |
Configuration for the horizontal pod autoscaling feature, which increases or decreases the number of replica pods a replication controller has based on the resource usage of the existing pods.
|
|||
disabled
bool |
|
Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. When enabled, it ensures that a Heapster pod is running in the cluster, which is also used by the Cloud Monitoring service.
|
||
auth_kind
required |
|
The type of credential used.
|
||
cluster_ipv4_cidr |
The IP address range of the container pods in this cluster, in CIDR notation (e.g. 10.96.0.0/14). Leave blank to have one automatically chosen or specify a /14 block in 10.0.0.0/8.
|
|||
description |
An optional description of this cluster.
|
|||
initial_node_count
required |
The number of nodes to create in this cluster. You must ensure that your Compute Engine resource quota is sufficient for this number of instances. You must also have available firewall and routes quota. For requests, this field should only be used in lieu of a "nodePool" object, since this configuration (along with the "nodeConfig") will be used to create a "NodePool" object with an auto-generated name. Do not use this and a nodePool at the same time.
|
|||
location |
The list of Google Compute Engine locations in which the cluster's nodes should be located.
|
|||
logging_service |
|
The logging service the cluster should use to write logs. Currently available options: logging.googleapis.com - the Google Cloud Logging service.
none - no logs will be exported from the cluster.
if left as an empty string,logging.googleapis.com will be used.
|
||
master_auth |
The authentication information for accessing the master endpoint.
|
|||
username |
The username to use for HTTP basic authentication to the master endpoint.
|
|||
password |
The password to use for HTTP basic authentication to the master endpoint. Because the master endpoint is open to the Internet, you should create a strong password.
|
|||
cluster_ca_certificate |
Base64-encoded public certificate that is the root of trust for the cluster.
|
|||
client_certificate |
Base64-encoded public certificate used by clients to authenticate to the cluster endpoint.
|
|||
client_key |
Base64-encoded private key used by clients to authenticate to the cluster endpoint.
|
|||
monitoring_service |
|
The monitoring service the cluster should use to write metrics.
Currently available options: monitoring.googleapis.com - the Google Cloud Monitoring service.
none - no metrics will be exported from the cluster.
if left as an empty string, monitoring.googleapis.com will be used.
|
||
name |
The name of this cluster. The name must be unique within this project and zone, and can be up to 40 characters. Must be Lowercase letters, numbers, and hyphens only. Must start with a letter. Must end with a number or a letter.
|
|||
network |
The name of the Google Compute Engine network to which the cluster is connected. If left unspecified, the default network will be used.
To ensure it exists and it is operations, configure the network using 'gcompute_network' resource.
|
|||
node_config |
Parameters used in creating the cluster's nodes.
For requests, this field should only be used in lieu of a "nodePool" object, since this configuration (along with the "initialNodeCount") will be used to create a "NodePool" object with an auto-generated name. Do not use this and a nodePool at the same time. For responses, this field will be populated with the node configuration of the first node pool. If unspecified, the defaults are used.
|
|||
disk_size_gb |
Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB. If unspecified, the default disk size is 100GB.
|
|||
service_account |
The Google Cloud Platform Service Account to be used by the node VMs. If no Service Account is specified, the "default" service account is used.
|
|||
tags |
The list of instance tags applied to all nodes. Tags are used to identify valid sources or targets for network firewalls and are specified by the client during cluster or node pool creation. Each tag within the list must comply with RFC1035.
|
|||
image_type |
The image type to use for this node. Note that for a given image type, the latest version of it will be used.
|
|||
preemptible
bool |
|
Whether the nodes are created as preemptible VM instances. See: https://cloud.google.com/compute/docs/instances/preemptible for more inforamtion about preemptible VM instances.
|
||
labels |
The map of Kubernetes labels (key/value pairs) to be applied to each node. These will added in addition to any default label(s) that Kubernetes may apply to the node. In case of conflict in label keys, the applied set may differ depending on the Kubernetes version -- it's best to assume the behavior is undefined and conflicts should be avoided. For more information, including usage and the valid values, see: http://kubernetes.io/v1.1/docs/user-guide/labels.html An object containing a list of "key": value pairs.
Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
|
|||
local_ssd_count |
The number of local SSD disks to be attached to the node.
The limit for this value is dependant upon the maximum number of disks available on a machine per zone. See: https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits for more information.
|
|||
oauth_scopes |
The set of Google API scopes to be made available on all of the node VMs under the "default" service account.
The following scopes are recommended, but not required, and by default are not included: https://www.googleapis.com/auth/compute is required for mounting persistent storage on your nodes.
https://www.googleapis.com/auth/devstorage.read_only is required for communicating with gcr.io (the Google Container Registry).
If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are enabled, in which case their required scopes will be added.
|
|||
machine_type |
The name of a Google Compute Engine machine type (e.g.
n1-standard-1). If unspecified, the default machine type is n1-standard-1.
|
|||
metadata |
The metadata key/value pairs assigned to instances in the cluster.
Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes in length. These are reflected as part of a URL in the metadata server. Additionally, to avoid ambiguity, keys must not conflict with any other metadata keys for the project or be one of the four reserved keys: "instance-template", "kube-env", "startup-script", and "user-data" Values are free-form strings, and only have meaning as interpreted by the image running in the instance. The only restriction placed on them is that each value's size must be less than or equal to 32 KB.
The total size of all keys and values must be less than 512 KB.
An object containing a list of "key": value pairs.
Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
|
|||
project |
Default: None
|
The Google Cloud Platform project to use.
|
||
scopes |
Array of scopes to be used.
|
|||
service_account_email |
An optional service account email address if machineaccount is selected and the user does not wish to use the default email.
|
|||
service_account_file |
The path of a Service Account JSON file if serviceaccount is selected as type.
|
|||
state |
|
Whether the given object should exist in GCP
|
||
subnetwork |
The name of the Google Compute Engine subnetwork to which the cluster is connected.
|
|||
zone
required |
The zone where the cluster is deployed.
|
Notes¶
Note
- For authentication, you can set service_account_file using the
GCP_SERVICE_ACCOUNT_FILE
env variable. - For authentication, you can set service_account_email using the
GCP_SERVICE_ACCOUNT_EMAIL
env variable. - For authentication, you can set auth_kind using the
GCP_AUTH_KIND
env variable. - For authentication, you can set scopes using the
GCP_SCOPES
env variable. - Environment variables values will only be used if the playbook values are not set.
- The service_account_email and service_account_file options are mutually exclusive.
Examples¶
- name: create a cluster
gcp_container_cluster:
name: "test_object"
initial_node_count: 2
master_auth:
username: cluster_admin
password: my-secret-password
node_config:
machine_type: n1-standard-4
disk_size_gb: 500
zone: us-central1-a
project: "test_project"
auth_kind: "service_account"
service_account_file: "/tmp/auth.pem"
state: present
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description | ||
---|---|---|---|---|
addons_config
complex
|
success |
Configurations for the various addons available to run in the cluster.
|
||
http_load_balancing
complex
|
success |
Configuration for the HTTP (L7) load balancing controller addon, which makes it easy to set up HTTP load balancers for services in a cluster.
|
||
disabled
bool
|
success |
Whether the HTTP Load Balancing controller is enabled in the cluster. When enabled, it runs a small pod in the cluster that manages the load balancers.
|
||
horizontal_pod_autoscaling
complex
|
success |
Configuration for the horizontal pod autoscaling feature, which increases or decreases the number of replica pods a replication controller has based on the resource usage of the existing pods.
|
||
disabled
bool
|
success |
Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. When enabled, it ensures that a Heapster pod is running in the cluster, which is also used by the Cloud Monitoring service.
|
||
cluster_ipv4_cidr
str
|
success |
The IP address range of the container pods in this cluster, in CIDR notation (e.g. 10.96.0.0/14). Leave blank to have one automatically chosen or specify a /14 block in 10.0.0.0/8.
|
||
create_time
str
|
success |
The time the cluster was created, in RFC3339 text format.
|
||
current_master_version
str
|
success |
The current software version of the master endpoint.
|
||
current_node_count
int
|
success |
The number of nodes currently in the cluster.
|
||
current_node_version
str
|
success |
The current version of the node software components. If they are currently at multiple versions because they're in the process of being upgraded, this reflects the minimum version of all nodes.
|
||
description
str
|
success |
An optional description of this cluster.
|
||
endpoint
str
|
success |
The IP address of this cluster's master endpoint.
The endpoint can be accessed from the internet at https://username:[email protected]/ See the masterAuth property of this resource for username and password information.
|
||
expire_time
str
|
success |
The time the cluster will be automatically deleted in RFC3339 text format.
|
||
initial_cluster_version
str
|
success |
The software version of the master endpoint and kubelets used in the cluster when it was first created. The version can be upgraded over time.
|
||
initial_node_count
int
|
success |
The number of nodes to create in this cluster. You must ensure that your Compute Engine resource quota is sufficient for this number of instances. You must also have available firewall and routes quota. For requests, this field should only be used in lieu of a "nodePool" object, since this configuration (along with the "nodeConfig") will be used to create a "NodePool" object with an auto-generated name. Do not use this and a nodePool at the same time.
|
||
location
list
|
success |
The list of Google Compute Engine locations in which the cluster's nodes should be located.
|
||
logging_service
str
|
success |
The logging service the cluster should use to write logs. Currently available options: logging.googleapis.com - the Google Cloud Logging service.
none - no logs will be exported from the cluster.
if left as an empty string,logging.googleapis.com will be used.
|
||
master_auth
complex
|
success |
The authentication information for accessing the master endpoint.
|
||
username
str
|
success |
The username to use for HTTP basic authentication to the master endpoint.
|
||
password
str
|
success |
The password to use for HTTP basic authentication to the master endpoint. Because the master endpoint is open to the Internet, you should create a strong password.
|
||
cluster_ca_certificate
str
|
success |
Base64-encoded public certificate that is the root of trust for the cluster.
|
||
client_certificate
str
|
success |
Base64-encoded public certificate used by clients to authenticate to the cluster endpoint.
|
||
client_key
str
|
success |
Base64-encoded private key used by clients to authenticate to the cluster endpoint.
|
||
monitoring_service
str
|
success |
The monitoring service the cluster should use to write metrics.
Currently available options: monitoring.googleapis.com - the Google Cloud Monitoring service.
none - no metrics will be exported from the cluster.
if left as an empty string, monitoring.googleapis.com will be used.
|
||
name
str
|
success |
The name of this cluster. The name must be unique within this project and zone, and can be up to 40 characters. Must be Lowercase letters, numbers, and hyphens only. Must start with a letter. Must end with a number or a letter.
|
||
network
str
|
success |
The name of the Google Compute Engine network to which the cluster is connected. If left unspecified, the default network will be used.
To ensure it exists and it is operations, configure the network using 'gcompute_network' resource.
|
||
node_config
complex
|
success |
Parameters used in creating the cluster's nodes.
For requests, this field should only be used in lieu of a "nodePool" object, since this configuration (along with the "initialNodeCount") will be used to create a "NodePool" object with an auto-generated name. Do not use this and a nodePool at the same time. For responses, this field will be populated with the node configuration of the first node pool. If unspecified, the defaults are used.
|
||
disk_size_gb
int
|
success |
Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB. If unspecified, the default disk size is 100GB.
|
||
service_account
str
|
success |
The Google Cloud Platform Service Account to be used by the node VMs. If no Service Account is specified, the "default" service account is used.
|
||
tags
list
|
success |
The list of instance tags applied to all nodes. Tags are used to identify valid sources or targets for network firewalls and are specified by the client during cluster or node pool creation. Each tag within the list must comply with RFC1035.
|
||
image_type
str
|
success |
The image type to use for this node. Note that for a given image type, the latest version of it will be used.
|
||
preemptible
bool
|
success |
Whether the nodes are created as preemptible VM instances. See: https://cloud.google.com/compute/docs/instances/preemptible for more inforamtion about preemptible VM instances.
|
||
labels
dict
|
success |
The map of Kubernetes labels (key/value pairs) to be applied to each node. These will added in addition to any default label(s) that Kubernetes may apply to the node. In case of conflict in label keys, the applied set may differ depending on the Kubernetes version -- it's best to assume the behavior is undefined and conflicts should be avoided. For more information, including usage and the valid values, see: http://kubernetes.io/v1.1/docs/user-guide/labels.html An object containing a list of "key": value pairs.
Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
|
||
local_ssd_count
int
|
success |
The number of local SSD disks to be attached to the node.
The limit for this value is dependant upon the maximum number of disks available on a machine per zone. See: https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits for more information.
|
||
oauth_scopes
list
|
success |
The set of Google API scopes to be made available on all of the node VMs under the "default" service account.
The following scopes are recommended, but not required, and by default are not included: https://www.googleapis.com/auth/compute is required for mounting persistent storage on your nodes.
https://www.googleapis.com/auth/devstorage.read_only is required for communicating with gcr.io (the Google Container Registry).
If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are enabled, in which case their required scopes will be added.
|
||
machine_type
str
|
success |
The name of a Google Compute Engine machine type (e.g.
n1-standard-1). If unspecified, the default machine type is n1-standard-1.
|
||
metadata
dict
|
success |
The metadata key/value pairs assigned to instances in the cluster.
Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes in length. These are reflected as part of a URL in the metadata server. Additionally, to avoid ambiguity, keys must not conflict with any other metadata keys for the project or be one of the four reserved keys: "instance-template", "kube-env", "startup-script", and "user-data" Values are free-form strings, and only have meaning as interpreted by the image running in the instance. The only restriction placed on them is that each value's size must be less than or equal to 32 KB.
The total size of all keys and values must be less than 512 KB.
An object containing a list of "key": value pairs.
Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
|
||
node_ipv4_cidr_size
int
|
success |
The size of the address space on each node for hosting containers.
This is provisioned from within the container_ipv4_cidr range.
|
||
services_ipv4_cidr
str
|
success |
The IP address range of the Kubernetes services in this cluster, in CIDR notation (e.g. 1.2.3.4/29). Service addresses are typically put in the last /16 from the container CIDR.
|
||
subnetwork
str
|
success |
The name of the Google Compute Engine subnetwork to which the cluster is connected.
|
||
zone
str
|
success |
The zone where the cluster is deployed.
|
Status¶
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Maintenance¶
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Author¶
- Google Inc. (@googlecloudplatform)
Hint
If you notice any issues in this documentation you can edit this document to improve it.