Last active
November 24, 2023 19:58
-
-
Save ruzickap/6982495aa919223956ff2368f9b285e9 to your computer and use it in GitHub Desktop.
Create Amazon EKS cluster using eksctl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eux | |
export CLUSTER_NAME="${CLUSTER_NAME:-ruzickap}" | |
export AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION:-eu-central-1}" | |
export KUBECONFIG="/tmp/kubeconfig-${CLUSTER_NAME}.conf" | |
export TAGS="[email protected] Environment=dev Group=Cloud_Native Squad=Cloud_Container_Platform" | |
set -euxo pipefail | |
cat > "/tmp/eksctl-${CLUSTER_NAME}.yaml" << EOF | |
apiVersion: eksctl.io/v1alpha5 | |
kind: ClusterConfig | |
metadata: | |
name: ${CLUSTER_NAME} | |
region: ${AWS_DEFAULT_REGION} | |
tags: &tags | |
$(echo "${TAGS}" | sed "s/ /\\n /g; s/^/ /g; s/=/: /g") | |
iam: | |
withOIDC: true | |
managedNodeGroups: | |
- name: managed-ng-1 | |
amiFamily: AmazonLinux2 | |
# Uncomment to use - Arm-based AWS Graviton2 processors | |
# instanceType: t4g.medium | |
instanceType: t3a.medium | |
desiredCapacity: 2 | |
minSize: 0 | |
maxSize: 3 | |
volumeSize: 30 | |
tags: | |
<<: *tags | |
compliance:na:defender: eks-node | |
volumeEncrypted: true | |
EOF | |
eksctl create cluster --config-file "/tmp/eksctl-${CLUSTER_NAME}.yaml" --kubeconfig "${KUBECONFIG}" | |
echo -e "*****\n export KUBECONFIG=${KUBECONFIG} \n*****" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment