From 9cadbad1ecb0b8215c31c239f845cc8449bbe1b7 Mon Sep 17 00:00:00 2001 From: Jonathan Innis Date: Fri, 13 Oct 2023 16:55:16 -0700 Subject: [PATCH] Update examples to v1beta1 --- examples/v1beta1/100-cpu-limit.yaml | 28 +++++++++++ examples/v1beta1/al2-custom-ami.yaml | 40 +++++++++++++++ examples/v1beta1/al2-custom-userdata.yaml | 37 ++++++++++++++ examples/v1beta1/al2-kubelet-log-query.yaml | 49 ++++++++++++++++++ examples/v1beta1/bottlerocket.yaml | 36 +++++++++++++ examples/v1beta1/br-custom-userdata.yaml | 29 +++++++++++ examples/v1beta1/custom-family.yaml | 42 ++++++++++++++++ examples/v1beta1/general-purpose.yaml | 33 ++++++++++++ examples/v1beta1/large-instances.yaml | 32 ++++++++++++ examples/v1beta1/multiple-ebs.yaml | 50 +++++++++++++++++++ examples/v1beta1/node-ttls.yaml | 30 +++++++++++ examples/v1beta1/spot.yaml | 30 +++++++++++ .../v1beta1/ubuntu-kubelet-log-query.yaml | 49 ++++++++++++++++++ examples/v1beta1/windows-custom-userdata.yaml | 40 +++++++++++++++ examples/v1beta1/windows2019.yaml | 33 ++++++++++++ examples/v1beta1/windows2022.yaml | 33 ++++++++++++ .../en/preview/concepts/nodeclasses.md | 2 +- .../content/en/preview/concepts/nodepools.md | 2 +- 18 files changed, 593 insertions(+), 2 deletions(-) create mode 100644 examples/v1beta1/100-cpu-limit.yaml create mode 100644 examples/v1beta1/al2-custom-ami.yaml create mode 100644 examples/v1beta1/al2-custom-userdata.yaml create mode 100644 examples/v1beta1/al2-kubelet-log-query.yaml create mode 100644 examples/v1beta1/bottlerocket.yaml create mode 100644 examples/v1beta1/br-custom-userdata.yaml create mode 100644 examples/v1beta1/custom-family.yaml create mode 100644 examples/v1beta1/general-purpose.yaml create mode 100644 examples/v1beta1/large-instances.yaml create mode 100644 examples/v1beta1/multiple-ebs.yaml create mode 100644 examples/v1beta1/node-ttls.yaml create mode 100644 examples/v1beta1/spot.yaml create mode 100644 examples/v1beta1/ubuntu-kubelet-log-query.yaml create mode 100644 examples/v1beta1/windows-custom-userdata.yaml create mode 100644 examples/v1beta1/windows2019.yaml create mode 100644 examples/v1beta1/windows2022.yaml diff --git a/examples/v1beta1/100-cpu-limit.yaml b/examples/v1beta1/100-cpu-limit.yaml new file mode 100644 index 000000000000..302bbbd0282e --- /dev/null +++ b/examples/v1beta1/100-cpu-limit.yaml @@ -0,0 +1,28 @@ +# This example NodePool limits the amount of compute +# NodePool by Karpenter to 100 CPU cores +apiVersion: karpenter.sh/v1beta1 +kind: NodePool +metadata: + name: default +spec: + spec: + template: + spec: + nodeClassRef: + name: default + limits: + cpu: 100 +--- +apiVersion: karpenter.k8s.aws/v1beta1 +kind: EC2NodeClass +metadata: + name: default +spec: + amiFamily: AL2 + role: "KarpenterNodeRole-${CLUSTER_NAME}" # replace with your cluster name + subnetSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + securityGroupSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name \ No newline at end of file diff --git a/examples/v1beta1/al2-custom-ami.yaml b/examples/v1beta1/al2-custom-ami.yaml new file mode 100644 index 000000000000..3bee837259f0 --- /dev/null +++ b/examples/v1beta1/al2-custom-ami.yaml @@ -0,0 +1,40 @@ +# This example NodePool will provision instances using a custom EKS-Optimized AMI that belongs to the +# AL2 AMIFamily. If your AMIs are built off https://github.com/awslabs/amazon-eks-ami and can be bootstrapped +# by Karpenter, this may be a good fit for you. +apiVersion: karpenter.sh/v1beta1 +kind: NodePool +metadata: + name: default +spec: + template: + spec: + nodeClassRef: + name: al2 +--- +apiVersion: karpenter.k8s.aws/v1beta1 +kind: EC2NodeClass +metadata: + name: al2 +spec: + amiFamily: AL2 + role: "KarpenterNodeRole-${CLUSTER_NAME}" # replace with your cluster name + subnetSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + securityGroupSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + amiSelectorTerms: + - id: ami-123 + - id: ami-456 + userData: | + MIME-Version: 1.0 + Content-Type: multipart/mixed; boundary="BOUNDARY" + + --BOUNDARY + Content-Type: text/x-shellscript; charset="us-ascii" + + #!/bin/bash + echo "Running a custom user data script" + + --BOUNDARY-- diff --git a/examples/v1beta1/al2-custom-userdata.yaml b/examples/v1beta1/al2-custom-userdata.yaml new file mode 100644 index 000000000000..a98f1357ec11 --- /dev/null +++ b/examples/v1beta1/al2-custom-userdata.yaml @@ -0,0 +1,37 @@ +# This example NodePool will provision instances using the AL2 EKS-Optimized AMI. +# The UserData defined in spec.UserData needs to be in the MIME-multipart format, +# and will be prepended to a Karpenter managed section that will bootstrap the kubelet. +apiVersion: karpenter.sh/v1beta1 +kind: NodePool +metadata: + name: default +spec: + template: + spec: + nodeClassRef: + name: al2 +--- +apiVersion: karpenter.k8s.aws/v1beta1 +kind: EC2NodeClass +metadata: + name: al2 +spec: + amiFamily: AL2 + role: "KarpenterNodeRole-${CLUSTER_NAME}" # replace with your cluster name + subnetSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + securityGroupSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + userData: | + MIME-Version: 1.0 + Content-Type: multipart/mixed; boundary="BOUNDARY" + + --BOUNDARY + Content-Type: text/x-shellscript; charset="us-ascii" + + #!/bin/bash + echo "Running a custom user data script" + + --BOUNDARY-- diff --git a/examples/v1beta1/al2-kubelet-log-query.yaml b/examples/v1beta1/al2-kubelet-log-query.yaml new file mode 100644 index 000000000000..22569ce37217 --- /dev/null +++ b/examples/v1beta1/al2-kubelet-log-query.yaml @@ -0,0 +1,49 @@ +# This example NodePool will provision instances using the AL2 EKS-Optimized AMI +# and will be prepended to a Karpenter managed section that will bootstrap the kubelet. +apiVersion: karpenter.sh/v1beta1 +kind: NodePool +metadata: + name: default +spec: + template: + spec: + nodeClassRef: + name: al2 +--- +apiVersion: karpenter.k8s.aws/v1beta1 +kind: EC2NodeClass +metadata: + name: al2 +spec: + amiFamily: AL2 + role: "KarpenterNodeRole-${CLUSTER_NAME}" # replace with your cluster name + subnetSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + securityGroupSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + userData: | + MIME-Version: 1.0 + Content-Type: multipart/mixed; boundary="BOUNDARY" + + --BOUNDARY + Content-Type: text/x-shellscript; charset="us-ascii" + + #!/bin/bash + + set -e + + # Add additional KUBELET_EXTRA_ARGS to the service + # Requires Kubernetes 1.27 (alpha feature) + cat << EOF > /etc/systemd/system/kubelet.service.d/90-kubelet-extra-args.conf + [Service] + Environment="KUBELET_EXTRA_ARGS=--feature-gates=NodeLogQuery=true $KUBELET_EXTRA_ARGS" + EOF + systemctl daemon-reload + + # Enable log handler and log query to the kubelet configuration + echo "$(jq '.enableSystemLogHandler=true' /etc/kubernetes/kubelet/kubelet-config.json)" > /etc/kubernetes/kubelet/kubelet-config.json + echo "$(jq '.enableSystemLogQuery=true' /etc/kubernetes/kubelet/kubelet-config.json)" > /etc/kubernetes/kubelet/kubelet-config.json + + --BOUNDARY-- \ No newline at end of file diff --git a/examples/v1beta1/bottlerocket.yaml b/examples/v1beta1/bottlerocket.yaml new file mode 100644 index 000000000000..b23521cf8095 --- /dev/null +++ b/examples/v1beta1/bottlerocket.yaml @@ -0,0 +1,36 @@ +# This example NodePool will provision instances +# running Bottlerocket OS +apiVersion: karpenter.sh/v1beta1 +kind: NodePool +metadata: + name: default +spec: + template: + spec: + nodeClassRef: + name: bottlerocket +--- +apiVersion: karpenter.k8s.aws/v1beta1 +kind: EC2NodeClass +metadata: + name: bottlerocket +spec: + amiFamily: Bottlerocket + role: "KarpenterNodeRole-${CLUSTER_NAME}" # replace with your cluster name + subnetSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + securityGroupSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + blockDeviceMappings: + - deviceName: /dev/xvda + ebs: + volumeType: gp3 + volumeSize: 4Gi + deleteOnTermination: true + - deviceName: /dev/xvdb + ebs: + volumeType: gp3 + volumeSize: 20Gi # replace with your required disk size + deleteOnTermination: true diff --git a/examples/v1beta1/br-custom-userdata.yaml b/examples/v1beta1/br-custom-userdata.yaml new file mode 100644 index 000000000000..deea6ece4db2 --- /dev/null +++ b/examples/v1beta1/br-custom-userdata.yaml @@ -0,0 +1,29 @@ +# This example NodePool will provision instances +# running Bottlerocket OS and the userData settings specified in ths AWSNodeTemplate +# CRD will be merged into Karpenter defaults. +apiVersion: karpenter.sh/v1beta1 +kind: NodePool +metadata: + name: default +spec: + template: + spec: + nodeClassRef: + name: bottlerocket +--- +apiVersion: karpenter.k8s.aws/v1beta1 +kind: EC2NodeClass +metadata: + name: bottlerocket +spec: + amiFamily: Bottlerocket + role: "KarpenterNodeRole-${CLUSTER_NAME}" # replace with your cluster name + subnetSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + securityGroupSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + userData: | + [settings.kubernetes] + kube-api-qps = 30 diff --git a/examples/v1beta1/custom-family.yaml b/examples/v1beta1/custom-family.yaml new file mode 100644 index 000000000000..e9e38c854609 --- /dev/null +++ b/examples/v1beta1/custom-family.yaml @@ -0,0 +1,42 @@ +# This example provisioner will provision instances using an AMI that belongs to a custom AMIFamily +# Keep in mind, that you're in charge of bootstrapping your worker nodes. + +apiVersion: karpenter.sh/v1beta1 +kind: NodePool +metadata: + name: default +spec: + template: + spec: + nodeClassRef: + name: custom-family +--- +apiVersion: karpenter.k8s.aws/v1beta1 +kind: EC2NodeClass +metadata: + name: custom-family +spec: + amiFamily: Custom + role: "KarpenterNodeRole-${CLUSTER_NAME}" # replace with your cluster name + subnetSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + securityGroupSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + amiSelectorTerms: + - id: ami-123 + - id: ami-456 + userData: | + MIME-Version: 1.0 + Content-Type: multipart/mixed; boundary="BOUNDARY" + + --BOUNDARY + Content-Type: text/x-shellscript; charset="us-ascii" + + #!/bin/bash + echo "Running my custom set-up" + + /etc/eks/bootstrap.sh my-cluster --kubelet-extra-args='--node-labels=foo=bar' + + --BOUNDARY diff --git a/examples/v1beta1/general-purpose.yaml b/examples/v1beta1/general-purpose.yaml new file mode 100644 index 000000000000..c054730939a8 --- /dev/null +++ b/examples/v1beta1/general-purpose.yaml @@ -0,0 +1,33 @@ +# This example NodePool will provision general purpose instances +apiVersion: karpenter.sh/v1beta1 +kind: NodePool +metadata: + name: default +spec: + template: + spec: + requirements: + # Include general purpose instance families + - key: karpenter.k8s.aws/instance-family + operator: In + values: [c5, m5, r5] + # Exclude small instance sizes + - key: karpenter.k8s.aws/instance-size + operator: NotIn + values: [nano, micro, small, large] + nodeClassRef: + name: default +--- +apiVersion: karpenter.k8s.aws/v1beta1 +kind: EC2NodeClass +metadata: + name: default +spec: + amiFamily: AL2 + role: "KarpenterNodeRole-${CLUSTER_NAME}" # replace with your cluster name + subnetSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + securityGroupSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name diff --git a/examples/v1beta1/large-instances.yaml b/examples/v1beta1/large-instances.yaml new file mode 100644 index 000000000000..b63ca70e0993 --- /dev/null +++ b/examples/v1beta1/large-instances.yaml @@ -0,0 +1,32 @@ +# This example NodePool will avoid small instance types in the cluster +apiVersion: karpenter.sh/v1beta1 +kind: NodePool +metadata: + name: default +spec: + template: + spec: + requirements: + # exclude instances with < 4 cores and < 8GiB memory (8192 mebibytes) + - key: "karpenter.k8s.aws/instance-cpu" + operator: Gt + values: ["3"] + - key: "karpenter.k8s.aws/instance-memory" + operator: Gt + values: ["8191"] + nodeClassRef: + name: default +--- +apiVersion: karpenter.k8s.aws/v1beta1 +kind: EC2NodeClass +metadata: + name: default +spec: + amiFamily: AL2 + role: "KarpenterNodeRole-${CLUSTER_NAME}" # replace with your cluster name + subnetSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + securityGroupSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name diff --git a/examples/v1beta1/multiple-ebs.yaml b/examples/v1beta1/multiple-ebs.yaml new file mode 100644 index 000000000000..c04515c613ce --- /dev/null +++ b/examples/v1beta1/multiple-ebs.yaml @@ -0,0 +1,50 @@ +# This example NodePool will provision instances +# with multiple EBS attached +apiVersion: karpenter.sh/v1beta1 +kind: NodePool +metadata: + name: default +spec: + template: + spec: + requirements: + # Include general purpose instance families + - key: karpenter.k8s.aws/instance-family + operator: In + values: [c6g, c7g, c6a, c6i, m6a, m6g, m6i, r6a, r6g, r6i] + # Exclude small instance sizes + - key: karpenter.k8s.aws/instance-size + operator: In + values: [medium, large, xlarge, xlarge, 2xlarge, 4xlarge] + nodeClassRef: + name: default +--- +apiVersion: karpenter.k8s.aws/v1beta1 +kind: EC2NodeClass +metadata: + name: default +spec: + amiFamily: AL2 + role: "KarpenterNodeRole-${CLUSTER_NAME}" # replace with your cluster name + subnetSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + securityGroupSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + blockDeviceMappings: + - deviceName: /dev/xvda + ebs: + volumeType: gp3 + volumeSize: 20Gi + deleteOnTermination: true + - deviceName: /dev/xvdb + ebs: + volumeType: gp3 + volumeSize: 100Gi + deleteOnTermination: true + - deviceName: /dev/xvdc + ebs: + volumeType: gp3 + volumeSize: 2000Gi + deleteOnTermination: true diff --git a/examples/v1beta1/node-ttls.yaml b/examples/v1beta1/node-ttls.yaml new file mode 100644 index 000000000000..7cbd2be7e651 --- /dev/null +++ b/examples/v1beta1/node-ttls.yaml @@ -0,0 +1,30 @@ +# This example NodePool will provision instances +# that are replaced every 7 days and drain after 1 minute +# with no workloads +apiVersion: karpenter.sh/v1beta1 +kind: NodePool +metadata: + name: default +spec: + template: + spec: + nodeClassRef: + name: default + disruption: + consolidationPolicy: WhenEmpty + consolidateAfter: 60s # scale down nodes after 60 seconds without workloads (excluding daemons) + expireAfter: 168h # expire nodes after 7 days = 7 * 24h +--- +apiVersion: karpenter.k8s.aws/v1beta1 +kind: EC2NodeClass +metadata: + name: default +spec: + amiFamily: AL2 + role: "KarpenterNodeRole-${CLUSTER_NAME}" # replace with your cluster name + subnetSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + securityGroupSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name diff --git a/examples/v1beta1/spot.yaml b/examples/v1beta1/spot.yaml new file mode 100644 index 000000000000..71f2328f92cb --- /dev/null +++ b/examples/v1beta1/spot.yaml @@ -0,0 +1,30 @@ +# This example will use spot instance type for all +# provisioned instances + +apiVersion: karpenter.sh/v1beta1 +kind: NodePool +metadata: + name: default +spec: + template: + spec: + requirements: + - key: karpenter.sh/capacity-type + operator: In + values: ["spot"] + nodeClassRef: + name: default +--- +apiVersion: karpenter.k8s.aws/v1beta1 +kind: EC2NodeClass +metadata: + name: default +spec: + amiFamily: AL2 + role: "KarpenterNodeRole-${CLUSTER_NAME}" # replace with your cluster name + subnetSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + securityGroupSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name diff --git a/examples/v1beta1/ubuntu-kubelet-log-query.yaml b/examples/v1beta1/ubuntu-kubelet-log-query.yaml new file mode 100644 index 000000000000..5768d657c69e --- /dev/null +++ b/examples/v1beta1/ubuntu-kubelet-log-query.yaml @@ -0,0 +1,49 @@ +# This example provisioner will provision instances using the Ubuntu EKS AMI +# and will be prepended to a Karpenter managed section that will bootstrap the kubelet. + +apiVersion: karpenter.sh/v1beta1 +kind: NodePool +metadata: + name: default +spec: + template: + spec: + nodeClassRef: + name: ubuntu +--- +apiVersion: karpenter.k8s.aws/v1beta1 +kind: EC2NodeClass +metadata: + name: ubuntu +spec: + amiFamily: Ubuntu + role: "KarpenterNodeRole-${CLUSTER_NAME}" # replace with your cluster name + subnetSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + securityGroupSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + userData: | + MIME-Version: 1.0 + Content-Type: multipart/mixed; boundary="BOUNDARY" + + --BOUNDARY + Content-Type: text/x-shellscript; charset="us-ascii" + + #!/bin/bash + # There is currently a bug with log query and kubelet running inside a snap environment + # https://github.com/kubernetes/kubernetes/issues/120618 + # This example is provided for reference on how to change Ubuntu settings in user data + + set -e + + # This requires Kubernetes 1.27 or above (alpha feature) + # This modifies the configuration of the /etc/eks/bootstrap.sh script because /etc/kubernetes/kubelet/kubelet-config.json + # doesn't exist before bootstrap.sh is run + + sed -i 's/args="$KUBELET_EXTRA_ARGS"/args="--feature-gates=NodeLogQuery=true $KUBELET_EXTRA_ARGS"/g' /etc/eks/bootstrap.sh + sed -i '/# writes kubeReserved and evictionHard/a echo "$(jq .enableSystemLogHandler=true $KUBELET_CONFIG)" > $KUBELET_CONFIG' /etc/eks/bootstrap.sh + sed -i '/# writes kubeReserved and evictionHard/a echo "$(jq .enableSystemLogQuery=true $KUBELET_CONFIG)" > $KUBELET_CONFIG' /etc/eks/bootstrap.sh + + --BOUNDARY-- \ No newline at end of file diff --git a/examples/v1beta1/windows-custom-userdata.yaml b/examples/v1beta1/windows-custom-userdata.yaml new file mode 100644 index 000000000000..ad7d7d9ba8a0 --- /dev/null +++ b/examples/v1beta1/windows-custom-userdata.yaml @@ -0,0 +1,40 @@ +# This example provisioner will provision instances using the Windows 2022 EKS-Optimized AMI. +# The UserData defined in spec.UserData should be PowerShell commands +# and they will be prepended to a Karpenter managed section that will bootstrap the kubelet. +# This example also applies to the Windows 2019 EKS-Optimized AMI. + +apiVersion: karpenter.sh/v1beta1 +kind: NodePool +metadata: + name: windows2022 +spec: + template: + spec: + requirements: + - key: kubernetes.io/os + operator: In + values: [ "windows" ] + nodeClassRef: + name: windows2022 +--- +apiVersion: karpenter.k8s.aws/v1beta1 +kind: EC2NodeClass +metadata: + name: windows2022 + annotations: + kubernetes.io/description: "Nodes running Windows Server 2022" +spec: + amiFamily: Windows2022 + role: "KarpenterNodeRole-${CLUSTER_NAME}" # replace with your cluster name + subnetSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + securityGroupSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + metadataOptions: + httpProtocolIPv6: disabled + httpTokens: required + userData: | + New-Item -Path 'C:\temp\' -ItemType Directory + New-Item -Path 'C:\temp\sample.txt' -ItemType File \ No newline at end of file diff --git a/examples/v1beta1/windows2019.yaml b/examples/v1beta1/windows2019.yaml new file mode 100644 index 000000000000..43dc90aceb13 --- /dev/null +++ b/examples/v1beta1/windows2019.yaml @@ -0,0 +1,33 @@ +# This example NodePool will provision instances running Windows Server 2019 +apiVersion: karpenter.sh/v1beta1 +kind: NodePool +metadata: + name: windows2019 +spec: + template: + spec: + requirements: + - key: kubernetes.io/os + operator: In + values: ["windows"] + nodeClassRef: + name: windows2019 +--- +apiVersion: karpenter.k8s.aws/v1beta1 +kind: EC2NodeClass +metadata: + name: windows2019 + annotations: + kubernetes.io/description: "Nodes running Windows Server 2019" +spec: + amiFamily: Windows2019 + role: "KarpenterNodeRole-${CLUSTER_NAME}" # replace with your cluster name + subnetSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + securityGroupSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + metadataOptions: + httpProtocolIPv6: disabled + httpTokens: required \ No newline at end of file diff --git a/examples/v1beta1/windows2022.yaml b/examples/v1beta1/windows2022.yaml new file mode 100644 index 000000000000..2c228682cbe2 --- /dev/null +++ b/examples/v1beta1/windows2022.yaml @@ -0,0 +1,33 @@ +# This example NodePool will provision instances running Windows Server 2022 +apiVersion: karpenter.sh/v1beta1 +kind: NodePool +metadata: + name: windows2022 +spec: + template: + spec: + requirements: + - key: kubernetes.io/os + operator: In + values: ["windows"] + nodeClassRef: + name: windows2022 +--- +apiVersion: karpenter.k8s.aws/v1beta1 +kind: EC2NodeClass +metadata: + name: windows2022 + annotations: + kubernetes.io/description: "Nodes running Windows Server 2022" +spec: + amiFamily: Windows2022 + role: "KarpenterNodeRole-${CLUSTER_NAME}" # replace with your cluster name + subnetSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + securityGroupSelectorTerms: + - tags: + karpenter.sh/discovery: "${CLUSTER_NAME}" # replace with your cluster name + metadataOptions: + httpProtocolIPv6: disabled + httpTokens: required \ No newline at end of file diff --git a/website/content/en/preview/concepts/nodeclasses.md b/website/content/en/preview/concepts/nodeclasses.md index 718e7eea3253..becf00f6fc88 100644 --- a/website/content/en/preview/concepts/nodeclasses.md +++ b/website/content/en/preview/concepts/nodeclasses.md @@ -123,7 +123,7 @@ status: # generated instance profile name instanceProfile: "${CLUSTER_NAME}-0123456778901234567789" ``` -Refer to the [NodePool docs]({{}}) for settings applicable to all providers. To explore various `EC2NodeClass` configurations, refer to the examples provided [in the Karpenter Github repository](https://github.com/aws/karpenter/blob/main/examples/nodepool/). +Refer to the [NodePool docs]({{}}) for settings applicable to all providers. To explore various `EC2NodeClass` configurations, refer to the examples provided [in the Karpenter Github repository](https://github.com/aws/karpenter/blob/main/examples/v1beta1/). ## spec.amiFamily diff --git a/website/content/en/preview/concepts/nodepools.md b/website/content/en/preview/concepts/nodepools.md index 68c2eb5726cf..8b151885309a 100644 --- a/website/content/en/preview/concepts/nodepools.md +++ b/website/content/en/preview/concepts/nodepools.md @@ -24,7 +24,7 @@ Here are things you should know about NodePools: * If Karpenter encounters a startup taint in the NodePool it will be applied to nodes that are provisioned, but pods do not need to tolerate the taint. Karpenter assumes that the taint is temporary and some other system will remove the taint. * It is recommended to create NodePools that are mutually exclusive. So no Pod should match multiple NodePools. If multiple NodePools are matched, Karpenter will use the NodePool with the highest [weight](#specweight). -For some example `NodePool` configurations, see the [examples in the Karpenter GitHub repository](https://github.com/aws/karpenter/blob/main/examples/nodepool/). +For some example `NodePool` configurations, see the [examples in the Karpenter GitHub repository](https://github.com/aws/karpenter/blob/main/examples/v1beta1/). ```yaml apiVersion: karpenter.sh/v1beta1