kubernetes_cluster

Synopsis

Requirements

  • pydo >= 0.1.3
  • azure-core >= 1.26.1

Parameters

Parameter Choices Default Comments
auto_upgrade
(bool)
False A boolean value indicating whether the cluster will be automatically upgraded to new patch releases during its maintenance window.
client_override_options
(dict)
Client override options (developer use). For example, can be used to override the DigitalOcean API endpoint for an internal test suite. If provided, these options will knock out existing options.
ha
(bool)
False 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. The property cannot be disabled.
maintenance_policy
(dict)
An object specifying the maintenance window policy for the Kubernetes cluster.
module_override_options
(dict)
Module override options (developer use). Can be used to override module options to support experimental or future options. If provided, these options will knock out existing options.
name
(str)
A human-readable name for a Kubernetes cluster.
node_pools
(list)
An object specifying the details of the worker nodes available to the Kubernetes cluster.
region
(str)
The slug identifier for the region where the Kubernetes cluster is located.
state
(str)
  • present
  • absent
present State of the resource, present to create, absent to destroy.
surge_upgrade
(bool)
False 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.
tags
(list)
An array of tags applied to the Kubernetes cluster. All clusters are automatically tagged k8s and k8s:$K8S_CLUSTER_ID.
timeout
(int)
300 Polling timeout in seconds.
token
(str)
DigitalOcean API token. There are several environment variables which can be used to provide this value. DIGITALOCEAN_ACCESS_TOKEN, DIGITALOCEAN_TOKEN, DO_API_TOKEN, DO_API_KEY, DO_OAUTH_TOKEN and OAUTH_TOKEN
version
(str)
The slug identifier for the version of Kubernetes used for the cluster. If set to a minor version (e.g. "1.14"), the latest version within it will be used (e.g. "1.14.6-do.1"). If set to "latest", the latest published version will be used. See the /v2/kubernetes/options endpoint to find all currently available versions.
vpc_uuid
(str)
A string specifying the UUID of the VPC to which the Kubernetes cluster is assigned.

Examples

- name: Create Kubernetes cluster
  digitalocean.cloud.kubernetes_cluster:
    token: "{{ token }}"
    state: present
    name: prod-cluster-01
    region: nyc1
    version: "1.18.6-do.0"
    node_pools:
      - size: s-1vcpu-2gb
        name: worker-pool
        count: 3

Return Values

Key Returned Description
error
(dict)
failure DigitalOcean API error.

Sample:

{
  "Message": "Informational error message.",
  "Reason": "Unauthorized",
  "Status Code": 401
}
kubernetes_cluster
(dict)
always Kubernetes cluster information.

Sample:

{
  "auto_upgrade": false,
  "cluster_subnet": "10.244.0.0/16",
  "created_at": "2018-11-15T16:00:11Z",
  "endpoint": "",
  "ha": false,
  "id": "bd5f5959-5e1e-4205-a714-a914373942af",
  "ipv4": "",
  "maintenance_policy": {
    "day": "any",
    "duration": "4h0m0s",
    "start_time": "00:00"
  },
  "name": "prod-cluster-01",
  "node_pools": [
    {
      "auto_scale": false,
      "count": 3,
      "id": "cdda885e-7663-40c8-bc74-3a036c66545d",
      "labels": null,
      "max_nodes": 0,
      "min_nodes": 0,
      "name": "worker-pool",
      "nodes": [
        {
          "created_at": "2018-11-15T16:00:11Z",
          "droplet_id": "",
          "id": "478247f8-b1bb-4f7a-8db9-2a5f8d4b8f8f",
          "name": "",
          "status": {
            "state": "provisioning"
          },
          "updated_at": "2018-11-15T16:00:11Z"
        },
        {
          "created_at": "2018-11-15T16:00:11Z",
          "droplet_id": "",
          "id": "ad12e744-c2a9-473d-8aa9-be5680500eb1",
          "name": "",
          "status": {
            "state": "provisioning"
          },
          "updated_at": "2018-11-15T16:00:11Z"
        },
        {
          "created_at": "2018-11-15T16:00:11Z",
          "droplet_id": "",
          "id": "e46e8d07-f58f-4ff1-9737-97246364400e",
          "name": "",
          "status": {
            "state": "provisioning"
          },
          "updated_at": "2018-11-15T16:00:11Z"
        }
      ],
      "size": "s-1vcpu-2gb",
      "tags": [
        "k8s",
        "k8s:bd5f5959-5e1e-4205-a714-a914373942af",
        "k8s:worker"
      ],
      "taints": []
    }
  ],
  "region": "nyc1",
  "registry_enabled": false,
  "service_subnet": "10.245.0.0/16",
  "status": {
    "message": "provisioning",
    "state": "provisioning"
  },
  "surge_upgrade": false,
  "tags": [
    "k8s",
    "k8s:bd5f5959-5e1e-4205-a714-a914373942af"
  ],
  "updated_at": "2018-11-15T16:00:11Z",
  "version": "1.18.6-do.0",
  "vpc_uuid": "c33931f2-a26a-4e61-b85c-4e95a2ec431b"
}
msg
(str)
always Kubernetes cluster result information.

Sample:

[
  "Created Kubernetes cluster prod-cluster-01 (9cc10173-e9ea-4176-9dbc-a4cee4c4ff30) in nyc3",
  "Created Kubernetes cluster prod-cluster-01 (9cc10173-e9ea-4176-9dbc-a4cee4c4ff30) in nyc3 is not \u0027running\u0027, it is \u0027provisioning\u0027",
  "Kubernetes cluster prod-cluster-01 in nyc3 would be created",
  "Kubernetes cluster prod-cluster-01 (9cc10173-e9ea-4176-9dbc-a4cee4c4ff30) in nyc3 exists",
  "Kubernetes cluster prod-cluster-01 in nyc3 does not exist",
  "Kubernetes cluster prod-cluster-01 (9cc10173-e9ea-4176-9dbc-a4cee4c4ff30) in nyc3 would be deleted"
]
In this article...