Skip to content

Instantly share code, notes, and snippets.

@serhiiluhovyi
Last active August 17, 2020 19:34
Show Gist options
  • Select an option

  • Save serhiiluhovyi/c484b284f1b5f6e6899d17fcc69bf18f to your computer and use it in GitHub Desktop.

Select an option

Save serhiiluhovyi/c484b284f1b5f6e6899d17fcc69bf18f to your computer and use it in GitHub Desktop.
  1. create ec2 bootstrap instance

  2. ssh to ec2

aws configure
  1. install kops

https://github.com/kubernetes/kops/blob/master/docs/getting_started/aws.md

curl -Lo kops https://github.com/kubernetes/kops/releases/download/$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)/kops-linux-amd64
chmod +x ./kops
sudo mv ./kops /usr/local/bin/
  1. install kubectl
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
  1. https://github.com/kubernetes/kops/blob/master/docs/getting_started/aws.md#setup-iam-user

  2. https://github.com/kubernetes/kops/blob/master/docs/getting_started/aws.md#cluster-state-storage

aws s3api create-bucket \
    --bucket svl-kops-state-store \
    --region us-east-1
  1. https://github.com/kubernetes/kops/blob/master/docs/getting_started/aws.md#creating-your-first-cluster
export NAME=svlcluster.k8s.local
export KOPS_STATE_STORE=s3://svl-kops-state-store
aws ec2 describe-availability-zones --region eu-central-1
eu-central-1a
eu-central-1b
eu-central-1c
kops create cluster \
    --zones eu-central-1a,eu-central-1b,eu-central-1c \
    ${NAME}
ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa
kops create secret --name ${NAME} sshpublickey admin -i ~/.ssh/id_rsa.pub
kops edit cluster ${NAME}
kops edit ig nodes --name ${NAME}
kops get ig --name ${NAME}
kops update cluster ${NAME} --yes

Cluster is starting.  It should be ready in a few minutes.

Suggestions:
 * validate cluster: kops validate cluster --wait 10m
 * list nodes: kubectl get nodes --show-labels
 * ssh to the master: ssh -i ~/.ssh/id_rsa ubuntu@api.svlcluster.k8s.local
 * the ubuntu user is specific to Ubuntu. If not using Ubuntu please use the appropriate user based on your OS.
 * read about installing addons at: https://kops.sigs.k8s.io/operations/addons.
scp -i key.pem -r fleetman ec2-user@18.185.96.228:/home/ec2-user
scp -i key.pem -r elk ec2-user@3.122.229.25:/home/ec2-user
kops delete cluster --name ${NAME} --yes

for restart reexport env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment