forked from aws-samples/amazon-eks-ami-rhel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_nodegroup_zsh.sh
executable file
·46 lines (40 loc) · 1.15 KB
/
create_nodegroup_zsh.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/zsh
EKS_CLUSTER=$1
AMI_ID=$2
MANAGED_NODE_GROUP=$3
AWS_REGION=$4
KEY_PAIR=$5
INSTANCE_TYPE=$6
MIN_SIZE=$7
DESIRED_SIZE=$8
MAX_SIZE=$9
USER_DATA=$(printf "#!/bin/bash\n\n/etc/eks/bootstrap.sh $EKS_CLUSTER --container-runtime containerd\nsystemctl disable nm-cloud-setup.timer\nsystemctl disable nm-cloud-setup.service\nreboot" | base64)
DATE_TIME=$(date +'%Y%m%d%H%M')
cat > managednodegroup-$DATE_TIME.yaml << EOF
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: $EKS_CLUSTER
region: $AWS_REGION
managedNodeGroups:
- name: $MANAGED_NODE_GROUP
minSize: $MIN_SIZE
desiredCapacity: $DESIRED_SIZE
maxSize: $MAX_SIZE
ami: $AMI_ID
amiFamily: AmazonLinux2
instanceType: $INSTANCE_TYPE
labels:
role: worker
tags:
nodegroup-name: $MANAGED_NODE_GROUP
privateNetworking: true
overrideBootstrapCommand: |
#!/bin/bash
/etc/eks/bootstrap.sh $EKS_CLUSTER --container-runtime containerd
systemctl disable nm-cloud-setup.timer
systemctl disable nm-cloud-setup.service
reboot
EOF
eksctl create nodegroup --config-file=managednodegroup-$DATE_TIME.yaml --cfn-disable-rollback