Intro
Kubernetes is a platform for container orchestraion. Amazon Web Services is most popular platform for virtual infrastructure. There are a multiple options to install Kubernetes on AWS.
In this post i’ll try to overview kops (aka Kubernetes Operations).
kops overview
kops authors describe it with
Kubernetes Operations (kops) - Production Grade K8s Installation, Upgrades, and Management
- Golang based
- Kubernetes-like format (yaml) to describe clusters/instance groups/etc.
- Can produce configurations in Terraform or CloudFormation format.
- Debian as operating system for k8s. See about other OS support.
- Multi-master k8s supported
- Kubenet by default. Also supports CNI
Install Kubernetes with kops
Get kops
sudo wget https://github.com/kubernetes/kops/releases/download/1.6.0/kops-linux-amd64 -O /usr/local/bin/kops
sudo chmod +x /usr/local/bin/kops
Prerequisites
Before proceed with Kubernetes installation make sure:
kubectl
installedaws
cli configured- AWS Route53 hosted zone -
aws route53 list-hosted-zones
- AWS S3 bucket -
aws s3 ls
terraform
installed (Optional)
Let kops generate Terraform config
By default kops creates resources using AWS APIs directly. In this post i’m using Terraform. If you want to proceed with default deployment just remove --target=terraform
.
Command below will inspect AWS for necessary resources (e.g. route53 hosted zone), generate necessary artifacts (see below) and produce terraform
configuration file. Options details here.
Kubernetes configuration to be deployed:
- Kubernetes version 1.6.2 (for May 2017)
- Single k8s master plus two vms (1+2). For multi-master see here.
- Kubenet AWS VPC networking
- Amazon EBS volume driver
kops create cluster \
--name=kubernetes.r7v.de \
--out=. \
--target=terraform \
--state=s3://rsokolkov \
--zones=us-east-1a
Terraform configuration in kubernetes.tf
.
Cluster configuration can be found in s3 bucket:
aws s3 ls s3://rsokolkov/kubernetes.r7v.de/
Look inside
Deploy Kubernetes with Terraform
terraform plan
terraform apply
Wait few minutes until DNS will propagate new entities.
Then check with
kubectl get nodes
Manipulate cluster
To see list of clusters
kops get clusters --state=s3://rsokolkov
To edit configuration consult this page or to scale cluster check other one.
Delete cluster
terraform destroy
kops delete cluster --name=kubernetes.r7v.de --state=s3://rsokolkov