community.digitalocean.digital_ocean_kubernetes module – Create and delete a DigitalOcean Kubernetes cluster
Note
This module is part of the community.digitalocean collection (version 1.24.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.digitalocean
.
To use it in a playbook, specify: community.digitalocean.digital_ocean_kubernetes
.
New in community.digitalocean 1.3.0
Synopsis
Create and delete a Kubernetes cluster in DigitalOcean (and optionally wait for it to be running).
Parameters
Parameter |
Comments |
---|---|
A boolean value indicating whether the cluster will be automatically upgraded to new patch releases during its maintenance window. Choices:
|
|
A boolean value indicating whether the control plane is run in a highly available configuration in the cluster. Highly available control planes incur less downtime. Choices:
|
|
An object specifying the maintenance window policy for the Kubernetes cluster (see table below). |
|
A human-readable name for a Kubernetes cluster. |
|
An object specifying the details of the worker nodes available to the Kubernetes cluster (see table below). Default: |
|
A boolean value indicating whether auto-scaling is enabled for this node pool. Choices:
|
|
The number of Droplet instances in the node pool. |
|
An object containing a set of Kubernetes labels. The keys are user-defined. |
|
The maximum number of nodes that this node pool can be auto-scaled to. The value will be |
|
The minimum number of nodes that this node pool can be auto-scaled to. The value will be |
|
A human-readable name for the node pool. |
|
The slug identifier for the type of Droplet used as workers in the node pool. |
|
An array containing the tags applied to the node pool. All node pools are automatically tagged |
|
An array of taints to apply to all nodes in a pool. Taints will automatically be applied to all existing nodes and any subsequent nodes added to the pool. When a taint is removed, it is removed from all nodes in the pool. |
|
DigitalOcean OAuth token; can be specified in |
|
The slug identifier for the region where the Kubernetes cluster will be created. Default: |
|
Controls whether or not to return the Choices:
|
|
The usual, Choices:
|
|
A boolean value indicating whether surge upgrade is enabled/disabled for the cluster. Surge upgrade makes cluster upgrades fast and reliable by bringing up new nodes before destroying the outdated nodes. Choices:
|
|
A flat array of tag names as strings to be applied to the Kubernetes cluster. All clusters will be automatically tagged “k8s” and “k8s:$K8S_CLUSTER_ID” in addition to any tags provided by the user. |
|
The slug identifier for the version of Kubernetes used for the cluster. See the /v2/kubernetes/options endpoint for available versions. Default: |
|
A string specifying the UUID of the VPC to which the Kubernetes cluster will be assigned. If excluded, the cluster will be assigned to your account’s default VPC for the region. |
|
Wait for the cluster to be running before returning. Choices:
|
|
How long before wait gives up, in seconds, when creating a cluster. Default: |
Examples
- name: Create a new DigitalOcean Kubernetes cluster in New York 1
community.digitalocean.digital_ocean_kubernetes:
state: present
oauth_token: "{{ lookup('env', 'DO_API_TOKEN') }}"
name: hacktoberfest
region: nyc1
node_pools:
- name: hacktoberfest-workers
size: s-1vcpu-2gb
count: 3
return_kubeconfig: true
wait_timeout: 600
register: my_cluster
- name: Show the kubeconfig for the cluster we just created
debug:
msg: "{{ my_cluster.data.kubeconfig }}"
- name: Destroy (delete) an existing DigitalOcean Kubernetes cluster
community.digitalocean.digital_ocean_kubernetes:
state: absent
oauth_token: "{{ lookup('env', 'DO_API_TOKEN') }}"
name: hacktoberfest
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
A DigitalOcean Kubernetes cluster (and optional Returned: changed Sample: |