From 3009c7715ddcb61475c1753ef00453c2ab78ca07 Mon Sep 17 00:00:00 2001 From: Jason Deal Date: Thu, 26 Oct 2023 10:47:59 -0700 Subject: [PATCH] update docs --- .../en/preview/concepts/nodeclasses.md | 71 ++++++++++++++----- 1 file changed, 54 insertions(+), 17 deletions(-) diff --git a/website/content/en/preview/concepts/nodeclasses.md b/website/content/en/preview/concepts/nodeclasses.md index 946cacb96d39..5665d5dd687f 100644 --- a/website/content/en/preview/concepts/nodeclasses.md +++ b/website/content/en/preview/concepts/nodeclasses.md @@ -29,35 +29,35 @@ metadata: name: default spec: # required, resolves a default ami and userdata - amiFamily: AL2 - + amiFamily: AL2 + # required, discovers subnets to attach to instances - subnetSelectorTerms: + subnetSelectorTerms: - tags: karpenter.sh/discovery: "${CLUSTER_NAME}" - + # required, discovers security groups to attach to instances - securityGroupSelectorTerms: + securityGroupSelectorTerms: - tags: karpenter.sh/discovery: "${CLUSTER_NAME}" # optional, discovers amis to override the amiFamily's default - amiSelectorTerms: + amiSelectorTerms: - tags: karpenter.sh/discovery: "${CLUSTER_NAME}" - + # optional, IAM role to use for the node identity role: "KarpenterNodeRole-${CLUSTER_NAME}" - + # optional, overrides autogenerated userdata with a merge semantic - userData: | + userData: | echo "Hello world" # optional, propagates tags to underlying EC2 resources - tags: + tags: team: team-a app: team-a-app - + # optional, configures IMDS for the instance metadataOptions: httpEndpoint: enabled @@ -65,6 +65,11 @@ spec: httpPutResponseHopLimit: 2 httpTokens: required + # options, configure network interfaces for the instance + - associatePublicIPAddress: true + description: "a network interface" + deviceIndex: 0 + # optional, configures storage devices for the instance blockDeviceMappings: - deviceName: /dev/xvda @@ -95,7 +100,7 @@ status: zone: us-east-2c - id: subnet-03941e7ad6afeaa72 zone: us-east-2a - + # resolved security groups securityGroups: - id: sg-041513b454818610b @@ -103,7 +108,7 @@ status: - id: sg-0286715698b894bca name: ControlPlaneSecurityGroup-1AQ073TSAAPW - # resolved AMIs + # resolved AMIs amis: - id: ami-01234567890123456 name: custom-ami-amd64 @@ -119,7 +124,7 @@ status: operator: In values: - arm64 - + # generated instance profile name instanceProfile: "${CLUSTER_NAME}-0123456778901234567789" ``` @@ -206,7 +211,7 @@ Karpenter will automatically query for the appropriate [EKS optimized AMI](https ### Custom -The `Custom` AMIFamily ships without any default userData to allow you to configure custom bootstrapping for control planes or images that don't support the default methods from the other families. +The `Custom` AMIFamily ships without any default userData to allow you to configure custom bootstrapping for control planes or images that don't support the default methods from the other families. ## spec.subnetSelectorTerms @@ -265,7 +270,7 @@ spec: ## spec.securityGroupSelectorTerms The security group of an instance is comparable to a set of firewall rules. -[EKS creates at least two security groups by default](https://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html). +[EKS creates at least two security groups by default](https://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html). {{% alert title="Tip" color="secondary" %}} Security groups may be specified by any tag, including "Name". Selecting tags using wildcards (`*`) is supported. @@ -531,6 +536,38 @@ spec: The `Custom` AMIFamily ships without any default `blockDeviceMappings`. +## spec.networkInterfaces + +The `networkInterfaces` field on the AWSNodeTemplate is mapped to [AWS EC2 LaunchTemplate NetworkInterfaces](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-networkinterface.html) +and can be used to configure the network interfaces that AWS EC2 will attach to the provisioned nodes. + +Learn more about [Network Interfaces](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html). + +### Examples + +Single network interface (with associated public IP): +```yaml +apiVersion: karpenter.k8s.aws/v1alpha1 +kind: AWSNodeTemplate +spec: + networkInterfaces: + - associatePublicIPAddress: true + description: "a network interface" + deviceIndex: 1 +``` + +Multiple network interfaces: +```yaml +apiVersion: karpenter.k8s.aws/v1alpha1 +kind: AWSNodeTemplate +spec: + networkInterfaces: + - description: "main network interface" + deviceIndex: 0 + - description: "secondary network interface" + deviceIndex: 1 +``` + ## spec.userData You can control the UserData that is applied to your worker nodes via this field. This allows you to run custom scripts or pass-through custom configuration to Karpenter instances on start-up. @@ -880,4 +917,4 @@ spec: role: "KarpenterNodeRole-${CLUSTER_NAME}" status: instanceProfile: "${CLUSTER_NAME}-0123456778901234567789" -``` \ No newline at end of file +```