Last active
November 13, 2018 01:04
-
-
Save tioxy/db619b89b080fb1165ea4d7c1839c3ab to your computer and use it in GitHub Desktop.
Create simple Kubernetes cluster using kops CLI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
export CLOUD_PROVIDER="aws" | |
# | |
# VARIABLES - AWS | |
# | |
export AWS_AVAILABLE_ZONES_MASTER="us-east-1c" | |
export AWS_AVAILABLE_ZONES_WORKER="us-east-1a,us-east-1b,us-east-1c" | |
export AWS_EC2_FAMILY_MASTER="t2.medium" | |
export AWS_EC2_FAMILY_WORKER="t2.medium" | |
export AWS_EC2_IMAGE="379101102735/debian-stretch-hvm-x86_64-gp2-2018-08-20-85640" | |
export AWS_RESOURCE_TAGS="Tool=k8s,Purpose=labs" | |
export AWS_ROUTE53_ZONE="tioxy.com" | |
export AWS_S3_BUCKET_NAME="tioxy-kops" | |
export AWS_SECGROUPS_MASTER="sg-09e97bab78ee5f82a" | |
export AWS_SECGROUPS_WORKER="sg-0fb0837417362d743" | |
export AWS_SUBNETS="subnet-9be555d1,subnet-74826c5a,subnet-23b94644" | |
export AWS_VPC="vpc-82f3a4f9" | |
# | |
# VARIABLES - Cluster | |
# | |
export CLUSTER_AMOUNT_MASTER=1 | |
export CLUSTER_AMOUNT_WORKER=2 | |
export CLUSTER_NAME="k8s.$AWS_ROUTE53_ZONE" | |
export CLUSTER_NETWORKING_INTERFACE="weave" | |
export CLUSTER_TOPOLOGY="public" | |
export CLUSTER_VERSION="1.10.5" | |
# | |
# VARIABLES - kops | |
# | |
export KOPS_STATE_STORE="s3://$AWS_S3_BUCKET_NAME" | |
export KOPS_OUTPUT="yaml" | |
export KOPS_OUTPUT_FILE="$HOME/.kube/.kops-create-output.yaml" | |
# | |
# KOPS - Create Cluster | |
# | |
kops create cluster $CLUSTER_NAME \ | |
--cloud $CLOUD_PROVIDER \ | |
--dns-zone $AWS_ROUTE53_ZONE \ | |
--zones $AWS_AVAILABLE_ZONES_WORKER --master-zones $AWS_AVAILABLE_ZONES_MASTER \ | |
--networking $CLUSTER_NETWORKING_INTERFACE \ | |
--cloud-labels $AWS_RESOURCE_TAGS \ | |
--image $AWS_EC2_IMAGE \ | |
--vpc $AWS_VPC \ | |
--subnets $AWS_SUBNETS \ | |
--kubernetes-version $CLUSTER_VERSION \ | |
--master-count $CLUSTER_AMOUNT_MASTER \ | |
--master-size $AWS_EC2_FAMILY_MASTER \ | |
--master-security-groups $AWS_SECGROUPS_MASTER \ | |
--node-count $CLUSTER_AMOUNT_WORKER \ | |
--node-size $AWS_EC2_FAMILY_WORKER \ | |
--node-security-groups $AWS_SECGROUPS_WORKER \ | |
--state $KOPS_STATE_STORE \ | |
--output $KOPS_OUTPUT \ | |
--out $KOPS_OUTPUT_FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment