Managed k8s cheatsheet

Commands that you most likely need to operate EKS/GKE/AKS clusters


# login to ECR
$(aws ecr get-login --region ${AWS_REGION})

# login to ECR AWSCLI v2
aws ecr get-login-password | docker login --username AWS --password-stdin ${ACCOUNT_ID}.dkr.ecr.${AWS_REGION}

# create EKS cluster
aws eks create-cluster --name ${CLUSTER_NAME} --role-arn ${ROLE_ARN} \
    --resources-vpc-config subnetIds=${SUBNET_A_ID},${SUBNET_B_ID},securityGroupIds=${SG_ID}

# get kubeconfig
aws eks ${AWS_REGION} update-kubeconfig --name ${CLUSTER_NAME} --region ${AWS_REGION}

# get auth token
aws eks get-token --name ${CLUSTER_NAME} --region ${AWS_REGION}

# list clusters
aws eks list-clusters --region ${AWS_REGION}

Google Cloud

# login to GCR
gcloud auth configure-docker

# create GKE cluster
gcloud container clusters create ${CLUSTER_NAME}

# gert GKE cluster credentials
gcloud container clusters get-credentials ${CLUSTER_NAME} --project ${MY_PROJECT}


# login to ACR
az acr login --subscription ${MY_SUBSCRIPTION_NAME} --name ${MY_REPO_NAME}

# create AKS cluster
az aks create --name ${CLUSTER_NAME} --resource-group ${REOURCE_GROUP_NAME}

# get kubeconfig
az aks get-credentials --resource-group ${REOURCE_GROUP_NAME} --name ${CLUSTER_NAME} --subscription ${MY_SUBSCRIPTION}

← Container deployment to ECS and CloudFormation
How did I create the Telegram Bot →