Skip to content

Commit

Permalink
Update examples to v1beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis committed Oct 14, 2023
1 parent f14db29 commit 9cadbad
Show file tree
Hide file tree
Showing 18 changed files with 593 additions and 2 deletions.
28 changes: 28 additions & 0 deletions examples/v1beta1/100-cpu-limit.yaml
Original file line number Diff line number Diff line change
@@ -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
40 changes: 40 additions & 0 deletions examples/v1beta1/al2-custom-ami.yaml
Original file line number Diff line number Diff line change
@@ -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--
37 changes: 37 additions & 0 deletions examples/v1beta1/al2-custom-userdata.yaml
Original file line number Diff line number Diff line change
@@ -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--
49 changes: 49 additions & 0 deletions examples/v1beta1/al2-kubelet-log-query.yaml
Original file line number Diff line number Diff line change
@@ -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--
36 changes: 36 additions & 0 deletions examples/v1beta1/bottlerocket.yaml
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions examples/v1beta1/br-custom-userdata.yaml
Original file line number Diff line number Diff line change
@@ -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
42 changes: 42 additions & 0 deletions examples/v1beta1/custom-family.yaml
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions examples/v1beta1/general-purpose.yaml
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions examples/v1beta1/large-instances.yaml
Original file line number Diff line number Diff line change
@@ -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
50 changes: 50 additions & 0 deletions examples/v1beta1/multiple-ebs.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 9cadbad

Please sign in to comment.