Kops is a top-tier tool for deploying Kubernetes clusters. Its versatility allows it to automatically set up high-availability Kubernetes clusters on platforms such as AWS, GCE, and VMWare vSphere. Here are some of its standout features:
Automated deployment of high-availability Kubernetes clusters.
Upgrade capability from clusters created with kube-up to Kops versions.
Dry-run and automatic idempotent upgrades, based on a state synchronization model.
Auto-generation of AWS CloudFormation and Terraform configurations.
Customizable extension add-ons.
Command-line auto-completion.
Installing kops and kubectl
# on macOSbrewinstallkubectlkops# on Linuxwgethttps://github.com/kubernetes/kops/releases/download/1.7.0/kops-linux-amd64chmod+xkops-linux-amd64mvkops-linux-amd64/usr/local/bin/kops
Launching on AWS
First, you'll need to install AWS CLI and configure IAM:
# install AWS CLIpipinstallawscli# configure iamawsiamcreate-group--group-namekopsawsiamattach-group-policy--policy-arnarn:aws:iam::aws:policy/AmazonEC2FullAccess--group-namekopsawsiamattach-group-policy--policy-arnarn:aws:iam::aws:policy/AmazonRoute53FullAccess--group-namekopsawsiamattach-group-policy--policy-arnarn:aws:iam::aws:policy/AmazonS3FullAccess--group-namekopsawsiamattach-group-policy--policy-arnarn:aws:iam::aws:policy/IAMFullAccess--group-namekopsawsiamattach-group-policy--policy-arnarn:aws:iam::aws:policy/AmazonVPCFullAccess--group-namekopsawsiamcreate-user--user-namekopsawsiamadd-user-to-group--user-namekops--group-namekopsawsiamcreate-access-key--user-namekops# configure the aws client to use your new IAM userawsconfigure# Use your new access and secret key hereawsiamlist-users# you should see a list of all your IAM users here# Because "aws configure" doesn't export these vars for kops to use, we export them nowexport AWS_ACCESS_KEY_ID=<access key>export AWS_SECRET_ACCESS_KEY=<secret key>
When your needs shift, you can delete your cluster:
kopsdeletecluster--name ${NAME} --yes
Launching on GCE
# Create cluster in GCE.# This is an alpha feature.export KOPS_STATE_STORE="gs://mybucket-kops"export ZONES=${MASTER_ZONES:-"us-east1-b,us-east1-c,us-east1-d"}export KOPS_FEATURE_FLAGS=AlphaAllowGCEkopscreateclusterkubernetes-k8s-gce.example.com--zones $ZONES \--master-zones $ZONES \--node-count3--projectmy-gce-project \--image"ubuntu-os-cloud/ubuntu-1604-xenial-v20170202" \--yes