Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Generate AWS credentials through https://console.aws.amazon.com/iam/home#/security_credential if you do NOT have them already
export AWS_ACCESS_KEY_ID=[...] # Replace [...] with the AWS Access Key ID
export AWS_SECRET_ACCESS_KEY=[...] # Replace [...] with the AWS Secret Access Key
export AWS_DEFAULT_REGION=us-east-2
# If Windows, use `tr '\r\n' ', '` instead of `tr '\n' ','`
export ZONES=$(aws ec2 describe-availability-zones \
--region $AWS_DEFAULT_REGION | jq -r \
'.AvailabilityZones[].ZoneName' | tr '\n' ',' | tr -d ' ')
ZONES=${ZONES%?}
echo $ZONES
mkdir -p cluster/keys
aws ec2 create-key-pair --key-name devops24 | jq -r '.KeyMaterial' >cluster/keys/devops24.pem
chmod 400 cluster/keys/devops24.pem
ssh-keygen -y -f cluster/keys/devops24.pem >cluster/keys/devops24.pub
export NAME=devops24.k8s.local
export BUCKET_NAME=devops24-$(date +%s)
aws s3api create-bucket --bucket $BUCKET_NAME \
--create-bucket-configuration \
LocationConstraint=$AWS_DEFAULT_REGION
export KOPS_STATE_STORE=s3://$BUCKET_NAME
kops create cluster --name $NAME --master-count 3 --node-count 3 \
--master-size t2.small --node-size t2.medium --zones $ZONES \
--master-zones $ZONES --ssh-public-key cluster/keys/devops24.pub \
--networking kubenet --yes
kops validate cluster # Repeat until `Your cluster devops24.k8s.local is ready` is output
kubectl create -f \
https://raw.githubusercontent.com/kubernetes/kops/master/addons/ingress-nginx/v1.6.0.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.