create_cluster
¶
create_cluster(
name: ClusterName,
role_arn: String,
resources_vpc_config: VpcConfigRequest,
*,
config_overrides: Optional[EKSClientConfig] = None,
version: Optional[String] = None,
kubernetes_network_config: Optional[KubernetesNetworkConfigRequest] = None,
logging: Optional[Logging] = None,
client_request_token: Optional[String] = None,
tags: Optional[TagMap] = None,
encryption_config: Optional[EncryptionConfigList] = None,
outpost_config: Optional[OutpostConfigRequest] = None,
access_config: Optional[CreateAccessConfigRequest] = None,
bootstrap_self_managed_addons: Optional[BoxedBoolean] = None,
upgrade_policy: Optional[UpgradePolicyRequest] = None,
zonal_shift_config: Optional[ZonalShiftConfigRequest] = None,
remote_network_config: Optional[RemoteNetworkConfigRequest] = None,
compute_config: Optional[ComputeConfigRequest] = None,
storage_config: Optional[StorageConfigRequest] = None,
deletion_protection: Optional[BoxedBoolean] = None,
control_plane_scaling_config: Optional[ControlPlaneScalingConfig] = None,
kube_api_server_config: Optional[KubeApiServerConfigRequest] = None,
kube_scheduler_config: Optional[KubeSchedulerConfigRequest] = None,
kube_controller_manager_config: Optional[KubeControllerManagerConfigRequest] = None,
) -> CreateClusterResponse
Creates an Amazon EKS control plane.
The Amazon EKS control plane consists of control plane instances that run the Kubernetes software, such as etcd and the API server. The control plane runs in an account managed by Amazon Web Services, and the Kubernetes API is exposed by the Amazon EKS API server endpoint. Each Amazon EKS cluster control plane is single tenant and unique. It runs on its own set of Amazon EC2 instances.
The cluster control plane is provisioned across multiple Availability Zones and fronted by an Elastic Load Balancing Network Load Balancer. Amazon EKS also provisions elastic network interfaces in your VPC subnets to provide connectivity from the control plane instances to the nodes (for example, to support kubectl exec, logs, and proxy data flows).
Amazon EKS nodes run in your Amazon Web Services account and connect to your cluster's control plane over the Kubernetes API server endpoint and a certificate file that is created for your cluster.
You can use the endpointPublicAccess and endpointPrivateAccess parameters to enable or disable public and private access to your cluster's Kubernetes API server endpoint. By default, public access is enabled, and private access is disabled. The endpoint domain name and IP address family depends on the value of the ipFamily for the cluster. For more information, see Amazon EKS Cluster Endpoint Access Control in the Amazon EKS User Guide .
You can use the logging parameter to enable or disable exporting the Kubernetes control plane logs for your cluster to CloudWatch Logs. By default, cluster control plane logs aren't exported to CloudWatch Logs. For more information, see Amazon EKS Cluster Control Plane Logs in the Amazon EKS User Guide .
CloudWatch Logs ingestion, archive storage, and data scanning rates apply to exported control plane logs. For more information, see CloudWatch Pricing.
In most cases, it takes several minutes to create a cluster. After you create an Amazon EKS cluster, you must configure your Kubernetes tooling to communicate with the API server and launch nodes into your cluster. For more information, see Allowing users to access your cluster and Launching Amazon EKS nodes in the Amazon EKS User Guide.
Parameters:
-
name(ClusterName) –The unique name to give to your cluster. The name can contain only alphanumeric characters (case-sensitive), hyphens, and underscores. It must start with an alphanumeric character and can't be longer than 100 characters. The name must be unique within the Amazon Web Services Region and Amazon Web Services account that you're creating the cluster in.
-
version(Optional[String], default:None) –The desired Kubernetes version for your cluster. If you don't specify a value here, the default version available in Amazon EKS is used.
The default version might not be the latest version available.
-
role_arn(String) –The Amazon Resource Name (ARN) of the IAM role that provides permissions for the Kubernetes control plane to make calls to Amazon Web Services API operations on your behalf. For more information, see Amazon EKS Service IAM Role in the Amazon EKS User Guide .
-
resources_vpc_config(VpcConfigRequest) –The VPC configuration that's used by the cluster control plane. Amazon EKS VPC resources have specific requirements to work properly with Kubernetes. For more information, see Cluster VPC Considerations and Cluster Security Group Considerations in the Amazon EKS User Guide. You must specify at least two subnets. You can specify up to five security groups. However, we recommend that you use a dedicated security group for your cluster control plane.
-
kubernetes_network_config(Optional[KubernetesNetworkConfigRequest], default:None) –The Kubernetes network configuration for the cluster.
-
logging(Optional[Logging], default:None) –Enable or disable exporting the Kubernetes control plane logs for your cluster to CloudWatch Logs . By default, cluster control plane logs aren't exported to CloudWatch Logs . For more information, see Amazon EKS Cluster control plane logs in the Amazon EKS User Guide .
CloudWatch Logs ingestion, archive storage, and data scanning rates apply to exported control plane logs. For more information, see CloudWatch Pricing.
-
client_request_token(Optional[String], default:None) –A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
-
tags(Optional[TagMap], default:None) –Metadata that assists with categorization and organization. Each tag consists of a key and an optional value. You define both. Tags don't propagate to any other cluster or Amazon Web Services resources.
-
encryption_config(Optional[EncryptionConfigList], default:None) –The encryption configuration for the cluster.
-
outpost_config(Optional[OutpostConfigRequest], default:None) –An object representing the configuration of your local Amazon EKS cluster on an Amazon Web Services Outpost. Before creating a local cluster on an Outpost, review Local clusters for Amazon EKS on Amazon Web Services Outposts in the Amazon EKS User Guide. This object isn't available for creating Amazon EKS clusters on the Amazon Web Services cloud.
-
access_config(Optional[CreateAccessConfigRequest], default:None) –The access configuration for the cluster.
-
bootstrap_self_managed_addons(Optional[BoxedBoolean], default:None) –If you set this value to
Falsewhen creating a cluster, the default networking add-ons will not be installed.The default networking add-ons include
vpc-cni,coredns, andkube-proxy.Use this option when you plan to install third-party alternative add-ons or self-manage the default networking add-ons.
-
upgrade_policy(Optional[UpgradePolicyRequest], default:None) –New clusters, by default, have extended support enabled. You can disable extended support when creating a cluster by setting this value to
STANDARD. -
zonal_shift_config(Optional[ZonalShiftConfigRequest], default:None) –Enable or disable ARC zonal shift for the cluster. If zonal shift is enabled, Amazon Web Services configures zonal autoshift for the cluster.
Zonal shift is a feature of Amazon Application Recovery Controller (ARC). ARC zonal shift is designed to be a temporary measure that allows you to move traffic for a resource away from an impaired AZ until the zonal shift expires or you cancel it. You can extend the zonal shift if necessary.
You can start a zonal shift for an Amazon EKS cluster, or you can allow Amazon Web Services to do it for you by enabling zonal autoshift. This shift updates the flow of east-to-west network traffic in your cluster to only consider network endpoints for Pods running on worker nodes in healthy AZs. Additionally, any ALB or NLB handling ingress traffic for applications in your Amazon EKS cluster will automatically route traffic to targets in the healthy AZs. For more information about zonal shift in EKS, see Learn about Amazon Application Recovery Controller (ARC) Zonal Shift in Amazon EKS in the Amazon EKS User Guide .
-
remote_network_config(Optional[RemoteNetworkConfigRequest], default:None) –The configuration in the cluster for EKS Hybrid Nodes. You can add, change, or remove this configuration after the cluster is created.
-
compute_config(Optional[ComputeConfigRequest], default:None) –Enable or disable the compute capability of EKS Auto Mode when creating your EKS Auto Mode cluster. If the compute capability is enabled, EKS Auto Mode will create and delete EC2 Managed Instances in your Amazon Web Services account
-
storage_config(Optional[StorageConfigRequest], default:None) –Enable or disable the block storage capability of EKS Auto Mode when creating your EKS Auto Mode cluster. If the block storage capability is enabled, EKS Auto Mode will create and delete EBS volumes in your Amazon Web Services account.
-
deletion_protection(Optional[BoxedBoolean], default:None) –Indicates whether to enable deletion protection for the cluster. When enabled, the cluster cannot be deleted unless deletion protection is first disabled. This helps prevent accidental cluster deletion. Default value is
false. -
control_plane_scaling_config(Optional[ControlPlaneScalingConfig], default:None) –The control plane scaling tier configuration. For more information, see EKS Provisioned Control Plane in the Amazon EKS User Guide.
-
kube_api_server_config(Optional[KubeApiServerConfigRequest], default:None) –The Kubernetes API server configuration for the new cluster.
-
kube_scheduler_config(Optional[KubeSchedulerConfigRequest], default:None) –The Kubernetes scheduler configuration for the new cluster.
-
kube_controller_manager_config(Optional[KubeControllerManagerConfigRequest], default:None) –The Kubernetes controller manager configuration for the new cluster.
Raises:
-
ClientException–These errors are usually caused by a client action. Actions can include using an action or resource on behalf of an IAM principal that doesn't have permissions to use the action or resource or specifying an identifier that is not valid.
-
InvalidParameterException–The specified parameter is invalid. Review the available parameters for the API request.
-
ResourceInUseException–The specified resource is in use.
-
ResourceLimitExceededException–You have encountered a service limit on the specified resource.
-
ServerException–These errors are usually caused by a server-side issue.
-
ServiceUnavailableException–The service is unavailable. Back off and retry the operation.
-
UnsupportedAvailabilityZoneException–At least one of your specified cluster subnets is in an Availability Zone that does not support Amazon EKS. The exception output specifies the supported Availability Zones for your account, from which you can choose subnets for your cluster.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To create a new cluster The following example creates an Amazon EKS cluster called prod.
>>> client.create_cluster(name='prod', version='1.10', role_arn='arn:aws:iam::012345678910:role/eks-service-role-AWSServiceRoleForAmazonEKS-J7ONKE3BQ4PI', resources_vpc_config={'subnetIds': ['subnet-6782e71e', 'subnet-e7e761ac'], 'securityGroupIds': ['sg-6979fe18']}, client_request_token='1d2129a1-3d38-460a-9756-e5b91fddb951')
Source code in docs_src/capo_eks/_services/eks.py
965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 | |