K8s Cluster

k8s_cluster

This is a simple module that supports creating or removing K8s Clusters. This module has a dependency on ionoscloud >= 6.0.2

Example Syntax


name: Create k8s cluster
ionoscloudsdk.ionoscloud.k8s_cluster:
  cluster_name: my-cluster-
  maintenance_window:
    day_of_the_week: Wednesday
    time: '12:02:00'
register: cluster_response


name: Update k8s cluster
ionoscloudsdk.ionoscloud.k8s_cluster:
  cluster_name: my_cluster
  k8s_cluster: ''
  maintenance_window:
    day_of_the_week: Wednesday
    time: '12:02:00'
  state: update
register: cluster


name: Delete k8s cluster
ionoscloudsdk.ionoscloud.k8s_cluster:
  k8s_cluster: ''
  state: absent
  wait: false

Returned object

{
    "changed": true,
    "failed": false,
    "action": "create",
    "cluster": {
        "entities": null,
        "href": "https://api.ionos.com/cloudapi/v6/k8s/b08b63ff-8bee-4091-ad5f-f8296eedd93b",
        "id": "b08b63ff-8bee-4091-ad5f-f8296eedd93b",
        "metadata": {
            "created_by": "<USER_EMAIL>",
            "created_by_user_id": "<USER_ID>",
            "created_date": "2023-05-31T09:42:32+00:00",
            "etag": "28a43faaa371c59d79d86aca2d6f7792",
            "last_modified_by": "<USER_EMAIL>",
            "last_modified_by_user_id": "<USER_ID>",
            "last_modified_date": "2023-05-31T09:42:32+00:00",
            "state": "DEPLOYING"
        },
        "properties": {
            "api_subnet_allow_list": null,
            "available_upgrade_versions": null,
            "k8s_version": null,
            "maintenance_window": {
                "day_of_the_week": "Wednesday",
                "time": "12:02:00Z"
            },
            "name": "my-cluster-4",
            "s3_buckets": null,
            "viable_node_pool_versions": null
        },
        "type": "k8s"
    }
}

For more examples please check out the tests here.

state: present

  
name: Create k8s cluster
ionoscloudsdk.ionoscloud.k8s_cluster:
  cluster_name: my-cluster-
  maintenance_window:
    day_of_the_week: Wednesday
    time: '12:02:00'
register: cluster_response

Available parameters for state present:

NameRequiredDescription

cluster_name str

True

The name of the K8s cluster.

k8s_version str

False

The Kubernetes version that the cluster is running. This limits which Kubernetes versions can run in a cluster's node pools. Also, not all Kubernetes versions are suitable upgrade targets for all earlier versions.

maintenance_window dict

False

The maintenance window is used to update the control plane and the K8s version of the cluster. If no value is specified, it is chosen dynamically, so there is no fixed default value.

api_subnet_allow_list list

False

Access to the K8s API server is restricted to these CIDRs. Intra-cluster traffic is not affected by this restriction. If no AllowList is specified, access is not limited. If an IP is specified without a subnet mask, the default value is 32 for IPv4 and 128 for IPv6.

s3_buckets_param list

False

List of S3 buckets configured for K8s usage. At the moment, it contains only one S3 bucket that is used to store K8s API audit logs.

public bool

False

The indicator whether the cluster is public or private. Note that the status FALSE is still in the beta phase.

location str

False

This attribute is mandatory if the cluster is private and optional if the cluster is public. The location must be enabled for your contract, or you must have a data center at that location. This property is not adjustable.

nat_gateway_ip str

False

The nat gateway IP of the cluster if the cluster is private. This property is immutable. Must be a reserved IP in the same location as the cluster's location. This attribute is mandatory if the cluster is private.

node_subnet str

False

The node subnet of the cluster, if the cluster is private. This property is optional and immutable. Must be a valid CIDR notation for an IPv4 network prefix of 16 bits length.

api_url str

False

The Ionos API base URL.

certificate_fingerprint str

False

The Ionos API certificate fingerprint.

username str

False

The Ionos username. Overrides the IONOS_USERNAME environment variable.

password str

False

The Ionos password. Overrides the IONOS_PASSWORD environment variable.

token str

False

The Ionos token. Overrides the IONOS_TOKEN environment variable.

wait bool

False

Wait for the resource to be created before returning. Default: True Options: [True, False]

wait_timeout int

False

How long before wait gives up, in seconds. Default: 3600

state str

False

Indicate desired state of the resource. Default: present Options: ['present', 'absent', 'update']

state: absent

  
name: Delete k8s cluster
ionoscloudsdk.ionoscloud.k8s_cluster:
  k8s_cluster: ''
  state: absent
  wait: false

Available parameters for state absent:

NameRequiredDescription

k8s_cluster str

True

The ID or name of the K8s cluster.

api_url str

False

The Ionos API base URL.

certificate_fingerprint str

False

The Ionos API certificate fingerprint.

username str

False

The Ionos username. Overrides the IONOS_USERNAME environment variable.

password str

False

The Ionos password. Overrides the IONOS_PASSWORD environment variable.

token str

False

The Ionos token. Overrides the IONOS_TOKEN environment variable.

wait bool

False

Wait for the resource to be created before returning. Default: True Options: [True, False]

wait_timeout int

False

How long before wait gives up, in seconds. Default: 3600

state str

False

Indicate desired state of the resource. Default: present Options: ['present', 'absent', 'update']

state: update

  
name: Update k8s cluster
ionoscloudsdk.ionoscloud.k8s_cluster:
  cluster_name: my_cluster
  k8s_cluster: ''
  maintenance_window:
    day_of_the_week: Wednesday
    time: '12:02:00'
  state: update
register: cluster

Available parameters for state update:

NameRequiredDescription

cluster_name str

False

The name of the K8s cluster.

k8s_cluster str

True

The ID or name of the K8s cluster.

k8s_version str

False

The Kubernetes version that the cluster is running. This limits which Kubernetes versions can run in a cluster's node pools. Also, not all Kubernetes versions are suitable upgrade targets for all earlier versions.

maintenance_window dict

True

The maintenance window is used to update the control plane and the K8s version of the cluster. If no value is specified, it is chosen dynamically, so there is no fixed default value.

api_subnet_allow_list list

False

Access to the K8s API server is restricted to these CIDRs. Intra-cluster traffic is not affected by this restriction. If no AllowList is specified, access is not limited. If an IP is specified without a subnet mask, the default value is 32 for IPv4 and 128 for IPv6.

s3_buckets_param list

False

List of S3 buckets configured for K8s usage. At the moment, it contains only one S3 bucket that is used to store K8s API audit logs.

api_url str

False

The Ionos API base URL.

certificate_fingerprint str

False

The Ionos API certificate fingerprint.

username str

False

The Ionos username. Overrides the IONOS_USERNAME environment variable.

password str

False

The Ionos password. Overrides the IONOS_PASSWORD environment variable.

token str

False

The Ionos token. Overrides the IONOS_TOKEN environment variable.

wait bool

False

Wait for the resource to be created before returning. Default: True Options: [True, False]

wait_timeout int

False

How long before wait gives up, in seconds. Default: 3600

state str

False

Indicate desired state of the resource. Default: present Options: ['present', 'absent', 'update']

Last updated