nodegroup#
State module for managing EKS Node groups.
- async idem_aws.states.aws.eks.nodegroup.present(hub, ctx, name: str, cluster_name: str, subnets: List[str], node_role: str, resource_id: str = None, scaling_config: NodegroupScalingConfig = None, disk_size: int = None, instance_types: List[str] = None, ami_type: str = None, remote_access: RemoteAccessConfig = None, labels: Dict[str, str] = None, taints: List[Taint] = None, tags: Dict[str, str] = None, client_request_token: str = None, launch_template: LaunchTemplateSpecification = None, update_config: NodegroupUpdateConfig = None, capacity_type: str = None, version: str = None, release_version: str = None, timeout: Timeout = None) Dict[str, Any] [source]#
Creates a managed node group for an Amazon EKS cluster.
You can only create a node group for your cluster that is equal to the current Kubernetes version for the cluster. All node groups are created with the latest AMI release version for the respective minor Kubernetes version of the cluster, unless you deploy a custom AMI using a launch template. For more information about using launch templates, see Launch template support. An Amazon EKS managed node group is an Amazon EC2 Auto Scaling group and associated Amazon EC2 instances that are managed by Amazon Web Services for an Amazon EKS cluster. Each node group uses a version of the Amazon EKS optimized Amazon Linux 2 AMI. For more information, see Managed Node Groups in the Amazon EKS User Guide.
- Parameters:
name (str) – An Idem name of EKS Node group.
cluster_name (str) – The name of the cluster to create the node group in.
subnets (list[str]) – The subnets to use for the Auto Scaling group that is created for your node group. If you specify launchTemplate, then don’t specify SubnetId in your launch template, or the node group deployment will fail. For more information about using launch templates with Amazon EKS, see Launch template support in the Amazon EKS User Guide.
node_role (str) – The Amazon Resource Name (ARN) of the IAM role to associate with your node group. The Amazon EKS worker node kubelet daemon makes calls to Amazon Web Services APIs on your behalf. Nodes receive permissions for these API calls through an IAM instance profile and associated policies. Before you can launch nodes and register them into a cluster, you must create an IAM role for those nodes to use when they are launched.
resource_id (str, Optional) – AWS EKS Node group name
scaling_config (dict[str, Any], Optional) –
The scaling configuration details for the Auto Scaling group that is created for your node group. Defaults to None.
- minSize (int, Optional):
The minimum number of nodes that the managed node group can scale in to.
- maxSize (int, Optional):
The maximum number of nodes that the managed node group can scale out to. For information about the maximum number that you can specify, see Amazon EKS service quotas in the Amazon EKS User Guide.
- desiredSize (int, Optional):
The current number of nodes that the managed node group should maintain. If you use Cluster Autoscaler, you shouldn’t change the desiredSize value directly, as this can cause the Cluster Autoscaler to suddenly scale up or scale down. Whenever this parameter changes, the number of worker nodes in the node group is updated to the specified size. If this parameter is given a value that is smaller than the current number of running worker nodes, the necessary number of worker nodes are terminated to match the given value. When using CloudFormation, no action occurs if you remove this parameter from your CFN template. This parameter can be different from minSize in some cases, such as when starting with extra hosts for testing. This parameter can also be different when you want to start with an estimated number of needed hosts, but let Cluster Autoscaler reduce the number if there are too many. When Cluster Autoscaler is used, the desiredSize parameter is altered by Cluster Autoscaler (but can be out-of-date for short periods of time). Cluster Autoscaler doesn’t scale a managed node group lower than minSize or higher than maxSize.
capacity_type (str, Optional) – The capacity type for your node group
disk_size (int, Optional) – The root device disk size (in GiB) for your node group instances. The default disk size is 20 GiB.
instance_types (list[str], Optional) – Specify the instance types for a node group. If you specify a GPU instance type, be sure to specify AL2_x86_64_GPU with the amiType parameter. If you specify launchTemplate, then you can specify zero or one instance type in your launch template or you can specify 0-20 instance types for instanceTypes. If however, you specify an instance type in your launch template and specify any instanceTypes, the node group deployment will fail. If you don’t specify an instance type in a launch template or for instanceTypes, then t3.medium is used, by default. If you specify Spot for capacityType, then we recommend specifying multiple values for instanceTypes. For more information, see Managed node group capacity types and Launch template support in the Amazon EKS User Guide. Defaults to None.
ami_type (str, Optional) – The AMI type for your node group. GPU instance types should use the AL2_x86_64_GPU AMI type. Non-GPU instances should use the AL2_x86_64 AMI type. Arm instances should use the AL2_ARM_64 AMI type.
remote_access (dict[str, Any], Optional) –
The remote access (SSH) configuration to use with your node group. If you specify launchTemplate, then don’t specify remoteAccess, or the node group deployment will fail. For more information about using launch templates with Amazon EKS, see Launch template support in the Amazon EKS User Guide. Defaults to None.
- ec2SshKey (str, Optional):
The Amazon EC2 SSH key that provides access for SSH communication with the nodes in the managed node group. For more information, see Amazon EC2 key pairs and Linux instances in the Amazon Elastic Compute Cloud User Guide for Linux Instances.
- sourceSecurityGroups (list[str], Optional):
The security groups that are allowed SSH access (port 22) to the nodes. If you specify an Amazon EC2 SSH key but do not specify a source security group when you create a managed node group, then port 22 on the nodes is opened to the internet (0.0.0.0/0). For more information, see Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide.
labels (dict[str, str], Optional) – The Kubernetes labels to be applied to the nodes in the node group when they are created. Defaults to None.
taints (list[dict[str, Any]], Optional) – The Kubernetes taints to be applied to the nodes in the node group. For more information, see Node taints on managed node groups. Defaults to None. * key (str, Optional): The key of the taint. * value (str, Optional): The value of the taint. * effect (str, Optional): The effect of the taint.
tags (dict, Optional) – The metadata to apply to the node group to assist with categorization and organization. Each tag consists of a key and an optional value. You define both. Node group tags do not propagate to any other resources associated with the node group, such as the Amazon EC2 instances or subnets.
client_request_token (str, Optional) – Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
launch_template (dict[str, Any], Optional) –
An object representing a node group’s launch template specification. If specified, then do not specify instanceTypes, diskSize, or remoteAccess and make sure that the launch template meets the requirements in launchTemplateSpecification. Defaults to None.
- name (str, Optional):
The name of the launch template.
- version (str, Optional):
The version of the launch template to use. If no version is specified, then the template’s default version is used.
- id (str, Optional):
The ID of the launch template.
update_config (dict[str, Any], Optional) –
The node group update configuration. Defaults to None.
- maxUnavailable (int, Optional):
The maximum number of nodes unavailable at once during a version update. Nodes will be updated in parallel. This value or maxUnavailablePercentage is required to have a value.The maximum number is 100.
- maxUnavailablePercentage (int, Optional):
The maximum percentage of nodes unavailable during a version update. This percentage of nodes will be updated in parallel, up to 100 nodes at once. This value or maxUnavailable is required to have a value.
version (str, Optional) – The Kubernetes version to use for your managed nodes. By default, the Kubernetes version of the cluster is used, and this is the only accepted specified value. If you specify launchTemplate, and your launch template uses a custom AMI, then don’t specify version, or the node group deployment will fail. For more information about using launch templates with Amazon EKS, see Launch template support in the Amazon EKS User Guide. Defaults to None.
release_version (str, Optional) – The AMI version of the Amazon EKS optimized AMI to use with your node group. By default, the latest available AMI version for the node group’s current Kubernetes version is used. For more information, see Amazon EKS optimized Amazon Linux 2 AMI versions in the Amazon EKS User Guide. If you specify launchTemplate, and your launch template uses a custom AMI, then don’t specify releaseVersion, or the node group deployment will fail. For more information about using launch templates with Amazon EKS, see Launch template support in the Amazon EKS User Guide. Defaults to None.
timeout (dict, Optional) –
Timeout configuration for creating or updating nodegroup.
- create (dict):
Timeout configuration for creating nodegroup * delay(int, default=30): The amount of time in seconds to wait between attempts. * max_attempts(int, default=80): Customized timeout configuration containing delay and max attempts.
- update (str):
Timeout configuration for updating nodegroup * delay(int, default=30): The amount of time in seconds to wait between attempts. * max_attempts(int, default=80): Customized timeout configuration containing delay and max attempts.
- Request Syntax:
[eks-nodegroup-name]: aws.eks.nodegroup.present: - cluster_name: "string" - node_group_arn: "string" - version: "string" - release_version: "string" - resource_id: "string" - status: "string" - capacity_type: "ON_DEMAND|SPOT" - instance_types: - string - subnets: - string - ami_type: "string" - node_role: "string" - disk_size: integer - scaling_config: desiredSize: integer maxSize: integer minSize: integer - update_config: maxUnavailable: integer - tags: - "string": "string"
- Returns:
Dict[str, Any]
Examples
nodes1: aws.eks.nodegroup.present: - cluster_name: idem-test-cluster - node_group_arn: arn:aws:eks:us-west-2:000000000000:nodegroup/prod/idem-test-instance-e1a573b9-4e74-48f0-85c4-c214a8ec8ada/id123 - version: '1.21' - release_version: 1.21.5-20220123 - resource_id: 'idem-test-cluster-node-group' - status: ACTIVE - capacity_type: ON_DEMAND - instance_types: - t1.micro - subnets: - subnet-31813031 - ami_type: AL2_x86_64 - node_role: arn:aws:iam::000000000000:role/idem-test-role-2075a427-24c2-4021-abc3-9b542834addb - disk_size: 20 - scaling_config: desiredSize: 2 maxSize: 2 minSize: 2 - update_config: maxUnavailable: 1 - tags: - Name: idem-test-instance-e1a573b9-4e74-48f0-85c4-c214a8ec8ada
- async idem_aws.states.aws.eks.nodegroup.absent(hub, ctx, name: str, cluster_name: str = None, resource_id: str = None, timeout: Dict = None) Dict[str, Any] [source]#
Autogenerated function
Deletes an Amazon EKS node group for a cluster.
- Parameters:
name (str) – An Idem name of EKS Node group.
cluster_name (str, None) – The name of the cluster to create the node group in.
resource_id (str, Optional) – AWS EKS Node group name. Idem automatically considers this resource being absent if this field is not specified.
timeout (dict, Optional) –
Timeout configuration for creating or updating cluster.
- delete (dict):
Timeout configuration for deleting cluster * delay: The amount of time in seconds to wait between attempts. * max_attempts: Customized timeout configuration containing delay and max attempts.
- Request Syntax:
[nodegroup-name]: aws.eks.nodegroup.absent: - cluster_name: 'string' - resource_id: 'string'
- Returns:
Dict[str, Any]
Examples
nodes1: aws.eks.nodegroup.absent: - cluster_name: idem-test-cluster - resource_id: idem-test-nodegroup
- async idem_aws.states.aws.eks.nodegroup.describe(hub, ctx) Dict[str, Dict[str, Any]] [source]#
Describe the resource in a way that can be recreated/managed with the corresponding “present” function
Lists the Amazon EKS managed node groups associated with the specified cluster in your Amazon Web Services account in the specified Region. Self-managed node groups are not listed.
- Returns:
Dict[str, Any]
Examples
$ idem describe aws.eks.nodegroup