- Build kubernetes cluster on AWS Private Hosted Zone i.e., Local DNS
- This configuration allows you to build multi-master cluster, spread accross multiple availability zones
- Customize your cluster! Choose Machine type, AMI, subnets and NAT gateway(s)
- Default configuation comes with three masters, two nodes.
- EC2 Full Access
- S3 Full Access
- IAM Full Access
- Route53 Full Access
- Services -> VPC -> Your VPC -> Create VPC
- Make note of vpc-id, you need it later
- Services -> Route53 -> Hosted Zones
- Create Hosted Zone
- Domain Name : k8scluster.local or your choice
- Type : Private Hosted Zone for Amazon VPC
- enableDnsHostnames
- Services -> VPC -> Select VPC -> Edit DNS Hostname : Yes : Save
- enableDnsSupport
- Services -> VPC -> Select VPC -> Edit DNS Resolution : Yes: Save
- Select IAM roles which was created in previous step while lauching this instance.
wget https://github.com/kubernetes/kops/releases/download/1.8.0/kops-linux-amd64curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectlchmod +x kops-linux-amd64 kubectlsudo mv kops-linux-amd64 /usr/local/bin/kopssudo mv kubectl /usr/local/bin/
- Service -> S3 : Create Bucket
- Name : your-clustername.k8scluster.local
- Enable versioning
- No public access, make it private
ssh-keygen -t rsa -b 4096 -C "e-mail"
export KOPS_STATE_STORE=s3://your-s3-bucket
- clone this repository
git clone https://github.com/SamsonGudise/k8scluster.local.gitvi create-preview-script.sh- edit parameters below, Kops can build those subnets for you or you can create subnets
- if you choose to create subnets, make sure provide subnet-ids for each subnets in config.yaml file
__CLUSTER__=your-clustername__DOMAIN__=k8scluster.local__STATEBUCKET__=your-clustername.k8scluster.local__PRIVATESUBNETA__=10.0.0.0/24__PRIVATESUBNETB__=10.0.1.0/24__PRIVATESUBNETC__=10.0.2.0/24__REGION__=us-west-2__VPCCIDR__=10.0.0.0/16__VPCID__=__VERSION__=__SSHWHITELIST__=0.0.0.0/0__APIWHITELIST__=0.0.0.0/0__PUBLICSUBNETA__=10.0.3.0/24__PUBLICSUBNETB__=10.0.4.0/24__PUBLICSUBNETC__=10.0.5.0/24__NODECOUNT__=2__SHKEY__=id_rsa.pub__IMAGE__=<centos_image>__MYTPE__=t2.medium
./create-preview-script.sh > build-script.shchmod +x build-script.shsudo mv build-script.sh /usr/local/bin/
/usr/local/bin/build-script.sh- verify preview. Take your time to read and understand preview.
- It is your opportunity to understand your cluster, such as
- How many autoscaling groups are being created
- Does it use Elastic Loadbalancer and how they are being used
- How many public, private subnets and NAT Gateways
- How many etcd volumes are created, hosts attached and why?
- run update script with --yes at the end
kops update cluster your-clustername.k8scluster.local --state=s3://your-s3bucket --yes
kops export kubecfg --name=your-clustername --state=s3://your-s3bucket