Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Created March 20, 2021 15:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save vfarcic/751681e594ad68c73612eb881a0e3f9a to your computer and use it in GitHub Desktop.
Save vfarcic/751681e594ad68c73612eb881a0e3f9a to your computer and use it in GitHub Desktop.
##############################################
# EKS Fargate vs. GKE Autopilot    #
# Fully Managed Kubernetes Clusters Compared #
# https://youtu.be/-59KDnNrIfc #
##############################################
# Referenced videos:
# - GKE Autopilot - Fully Managed Kubernetes Service From Google: https://youtu.be/Zztufl4mFQ4
# - eksctl - How to Create and Manage AWS EKS clusters: https://youtu.be/pNECqaxyewQ
#########
# Setup #
#########
git clone https://github.com/vfarcic/fargate-vs-autopilot-demo.git
cd fargate-vs-autopilot-demo
# Open 2 terminal sessions
#################
# Setup Fargate #
#################
# Terminal 1 (Fargate)
# Replace `[...]` with the Access Key ID
export AWS_ACCESS_KEY_ID=[...]
# Terminal 1 (Fargate)
# Replace `[...]` with the Secret Access Key
export AWS_SECRET_ACCESS_KEY=[...]
# Terminal 1 (Fargate)
export KUBECONFIG=$PWD/kubeconfig-fargate.yaml
###################
# Setup Autopilot #
###################
# Terminal 2 (Autopilot)
cd fargate-vs-autopilot-demo
# Terminal 2 (Autopilot)
export PROJECT_ID=dt-$(date +%Y%m%d%H%M%S)
# Terminal 2 (Autopilot)
gcloud projects create $PROJECT_ID
# Terminal 2 (Autopilot)
echo https://console.cloud.google.com/marketplace/product/google/container.googleapis.com?project=$PROJECT_ID
# Open the URL and *ENABLE* the API
# Terminal 2 (Autopilot)
export KUBECONFIG=$PWD/kubeconfig-autopilot.yaml
#####################
# Creating clusters #
#####################
# Terminal 1 (Fargate)
cat fargate.yaml
# Terminal 1 (Fargate)
eksctl create cluster \
--config-file fargate.yaml
# Terminal 2 (Autopilot)
gcloud container clusters \
create-auto devops-toolkit \
--region us-east1 \
--project $PROJECT_ID
# In all terminals
kubectl get nodes
########################
# Applying Deployments #
########################
# In all terminals
kubectl apply --filename deployment.yaml
# In all terminals
watch kubectl get pods,nodes
#######################
# Applying DaemonSets #
#######################
# In all terminals
kubectl apply --filename daemonset.yaml
# In all terminals
watch kubectl get pods,nodes
#######################
# Destroying clusters #
#######################
# Terminal 1 (Fargate)
eksctl delete cluster \
--config-file fargate.yaml
# Destroy the GCP project
gcloud projects delete $PROJECT_ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment