Skip to content

Instantly share code, notes, and snippets.

@ruzickap
Created March 27, 2023 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruzickap/fcd1303678e974352808a62898cc0668 to your computer and use it in GitHub Desktop.
Save ruzickap/fcd1303678e974352808a62898cc0668 to your computer and use it in GitHub Desktop.
Deploy Amazon EKS with Calico
#!/usr/bin/env bash
export CLUSTER_NAME="ruzickap-calico"
export AWS_DEFAULT_REGION="eu-central-1"
export KUBECONFIG="/tmp/kubeconfig-${CLUSTER_NAME}.conf"
export TAGS="Owner=petr.ruzicka@gmail.com Environment=dev"
set -euxo pipefail
cat > "/tmp/eksctl-${CLUSTER_NAME}.yaml" << EOF
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: ${CLUSTER_NAME}
region: ${AWS_DEFAULT_REGION}
version: "1.25"
tags: &tags
$(echo "${TAGS}" | sed "s/ /\\n /g; s/^/ /g; s/=/: /g")
iam:
withOIDC: true
managedNodeGroups:
- name: managed-ng-1
amiFamily: AmazonLinux2
# amiFamily: Bottlerocket
instanceType: t3a.medium
desiredCapacity: 2
minSize: 2
maxSize: 3
volumeSize: 20
volumeType: gp3
maxPodsPerNode: 100
tags:
<<: *tags
compliance:na:defender: eks-node
# compliance:na:defender: bottlerocket
volumeEncrypted: true
disableIMDSv1: true
EOF
eksctl create cluster --config-file "/tmp/eksctl-${CLUSTER_NAME}.yaml" --kubeconfig "${KUBECONFIG}" --without-nodegroup
kubectl delete daemonset -n kube-system aws-node
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.25.0/manifests/tigera-operator.yaml
kubectl create -f - <<EOF
kind: Installation
apiVersion: operator.tigera.io/v1
metadata:
name: default
spec:
kubernetesProvider: EKS
cni:
type: Calico
calicoNetwork:
bgp: Disabled
EOF
eksctl create nodegroup --config-file "/tmp/eksctl-${CLUSTER_NAME}.yaml"
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