Skip to content

Instantly share code, notes, and snippets.

@danielchg
Last active November 5, 2021 14:57
Show Gist options
  • Select an option

  • Save danielchg/343cd2a173c35ff1b499f6b3e0021d68 to your computer and use it in GitHub Desktop.

Select an option

Save danielchg/343cd2a173c35ff1b499f6b3e0021d68 to your computer and use it in GitHub Desktop.
Deploy a Kubernetes cluster on AWS with Kops
#!/bin/sh
# Create S3 Bucket
# aws s3api create-bucket --bucket mycluster.demo.example.com
# Create Route53 hosted zone
# aws route53 create-hosted-zone --name demo.example.com --caller-reference $(date +%Y%m%d)
# Set environment
export KOPS_STATE_STORE=s3://mycluster.demo.example.com
# We need to export the AWS env variables in order to authenticate us
kops create cluster \
--kubernetes-version v1.6.2 \
--node-count 3 \
--zones us-east-1a,us-east-1d,us-east-1e \
--master-zones us-east-1a,us-east-1d,us-east-1e \
--dns-zone demo.example.com \
--node-size t2.medium \
--master-size t2.medium \
--topology private \
--networking weave \
--network-cidr=172.16.0.0/16 \
--bastion=true \
mycluster.demo.example.com \
--ssh-public-key ~/.ssh/demo.pub
# Suggestions:
# * list clusters with: kops get cluster
# * edit this cluster with: kops edit cluster mycluster.demo.example.com
# * edit your node instance group: kops edit ig --name=mycluster.demo.example.com nodes
# * edit your master instance group: kops edit ig --name=mycluster.demo.example.com master-us-east-1a
# In order to add Kubernetes batch/v2alpha1, add restriction to access SSH and Kubernetes, increase the Disk Size to 100Gb on each instance
kops update cluster mycluster.demo.example.com --yes
# Install Kubernetes Dashboard
# kubectl create -f https://git.io/kube-dashboard
# kubectl proxy
# Open a browser to http://localhost:8001/ui
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment