This project contains kops and ansible commands to create kubernetes infrastructure in an "existing" vpc in an AWS. It also includes a gitlab-ci.yml to build an infrastructure in a pipeline. So, with 1 click, you can spin up or update or destroy your cluster. You can find more information about this project from my blog: here
To install kubernetes infrastructure in an AWS, you must have existing VPC. To have a vpc, you can build up with "terraform" or manually in aws console. Your vpc must have 3 private subnets, 3 public subnets, 3 AZs. and following tags in your private subnets:
VPC:
Private Subnets
Following tags must be exist in your public subnets:
Public Subnets
It includes a bunch of command to execute kops or ansible commands.
CLUSTER_NAME: <CLUSTER_NAME>
S3_BUCKET_NAME: <S3_BUCKET_NAME>
SSH_PEM_NAME: kube_clusterkey
KUBERNETES_VERSION: 1.9.6
NETWORK_CIDR: <NETWORK_CIDR>
VPC_ID: <VPC_UD>
DNS_ZONE_ID: <DNS_ZONE_ID>
ZONE1: us-east-1a
ZONE2: us-east-1b
ZONE3: us-east-1c
#PRIVATE1 SUBNET
SUBNET_CIDR1: <SUBNET_CIDR1>
SUBNET_ID1: <SUBNET_ID1>
#PRIVATE2 SUBNET
SUBNET_CIDR2: <SUBNET_CIDR2>
SUBNET_ID2: <SUBNET_ID2>
#PRIVATE3 SUBNET
SUBNET_CIDR3: <SUBNET_CIDR3>
SUBNET_ID3: <SUBNET_ID3>
#PUBLIC1(UTILITY) SUBNET
SUBNET_CIDR4: <SUBNET_CIDR4>
SUBNET_ID4: <SUBNET_ID4>
#PUBLIC2(UTILITY) SUBNET
SUBNET_CIDR5: <SUBNET_CIDR5>
SUBNET_ID5: <SUBNET_ID5>
#PUBLIC3(UTILITY) SUBNET
SUBNET_CIDR6: <SUBNET_CIDR6>
SUBNET_ID6: <SUBNET_ID6>
NODES_TYPE: t2.medium
NODES_DEFAULT_SIZE: 3
NODES_MIN_SIZE: 3
NODES_MAX_SIZE: 5
MASTER_DEFAULT_TYPE: t2.small
MASTER_DEFAULT_SIZE: 3
MASTER_US_EAST_1A_TYPE: t2.small
MASTER_US_EAST_1A_MIN_SIZE: 1
MASTER_US_EAST_1A_MAX_SIZE: 1
MASTER_US_EAST_1B_TYPE: t2.small
MASTER_US_EAST_1B_MIN_SIZE: 1
MASTER_US_EAST_1B_MAX_SIZE: 1
MASTER_US_EAST_1C_TYPE: t2.small
MASTER_US_EAST_1C_MIN_SIZE: 1
MASTER_US_EAST_1C_MAX_SIZE: 1
Here is the high level architecture of kubernetes cluster created by kops. All master and worker nodes will be created with autoscaling group in private subnet(not accessible directly from internet), ELB will be created in public subnet to access kubernetes api server end point from internet.
There are 4 stages(Create, Update, Rolling-update and destroy) in gitlab-ci to take an action in kubernetes cluster