Slide 1

Slide 1 text

Kubernetes Operations {KOPS}

Slide 2

Slide 2 text

About Me ● Sathya ● Ops @ Adobe.io ● Handled Dev/Ops/DBA/Data Migration/etc etc

Slide 3

Slide 3 text

Task ● Deploy Kubernetes on AWS ● Easy?

Slide 4

Slide 4 text

Maybe not..

Slide 5

Slide 5 text

Toolchain choices ● DIY ● Kubernetes Operations (“production grade”) ● Kube-up.sh (removed as of 1.6) ● Kubeadm ● Kube Spray ● CoreOS Techtonic

Slide 6

Slide 6 text

Kubernetes Operations (“kops”) ● Kubernetes Operations ○ Current recommended/supported for AWS ○ “Production grade” ○ Can create single/HA Master node ○ Kubectl for the cluster

Slide 7

Slide 7 text

What can kops do? ● Create clusters ○ Create new VPC ○ Use an existing VPC ● Update clusters ○ Increase node counts ○ Increase instance size ○ Rolling* updates ○ Change root volume size ○ Change instance group to Spot instances ● Upgrade clusters ○ Import/upgrade from kube-up to kops ○ Upgrade across versions

Slide 8

Slide 8 text

What else can kops do? ● Output config ○ Terraform ○ Cloudformation ○ Actually launch the instances ● Dry run by default ● Create Bastion host ● Tear down the cluster ● Many more. Read the docs!

Slide 9

Slide 9 text

Pre-requisites ● awscli installed ○ pip install awscli ● kubectl installed ○ Mac: brew install kubectl ○ Others ● AWS Account* ○ You maybe charged some amount ● kops installed ○ Mac: brew install kops ○ Linux

Slide 10

Slide 10 text

Way kops works ● Creates an IAM group ● Attach below group policies ○ AmazonEC2FullAccess ○ AmazonRoute53FullAccess ○ AmazonS3FullAccess ○ IAMFullAccess ○ AmazonVPCFullAccess ● Creates a user to this group ● Creates S3 bucket to store state

Slide 11

Slide 11 text

Way kops works ● Set the name of the cluster to NAME ● Set the master & node size/count ● kops create cluster ● …. ● Magic!

Slide 12

Slide 12 text

Points to note ● You do not* need control over domain ○ *caveat: kops needs to be v1.6.2 & above ■ Cluster name must end in .k8s.local ● Kops creates security groups for SSH open to all ○ Always review what kops does with kops edit cluster $NAME ● Kops creates masters & nodes in public subnet

Slide 13

Slide 13 text

Points to note ● Kops creates m3.medium for master and 2x t2.medium for nodes by default. ○ Size accordingly. ● Kops creates a new VPC, IGW, subnet but you can make it reuse existing VPC & subnets ○ export VPC_ID=vpc-12345678 ○ export NETWORK_CIDR=10.100.0.0/16 ○ kops create cluster ${NAME} --vpc=${VPC_ID}

Slide 14

Slide 14 text

Instance Groups ● Groups of similar machines ● Master IG, Node IG ● Edit IG, changes reflect on all instances ○ kops get instancegroups ○ kops edit ig ○ kops update cluster ${NAME} ● Changes apply to new instances only! ○ Do a rolling update to update existing instances

Slide 15

Slide 15 text

Hammertime! ● http://u.sbhat.me/kops-setup

Slide 16

Slide 16 text

Docs & References ● Kops Documentation - https://github.com/kubernetes/kops/tree/master/docs ● Deploying Highly Available Kubernetes cluster with Kops - https://renzedevries.wordpress.com/2017/02/09/deploying-a-highly-available-kuber netes-cluster-to-aws-using-kops/ ● AWS Blog - https://aws.amazon.com/blogs/compute/kubernetes-clusters-aws-kops/ ● Backstory of Kubernetes - https://changelog.com/podcast/250

Slide 17

Slide 17 text

Q&A? Reach me ● Twitter - sathyabhat ● DevUp Slack ○ Join in https://slackipy.herokuapp.com/ ○ #devops channel