Cheat Sheet

Useful Kops tricks.

Enable autocomplete

source <(kops completion bash)

Create cluster

Export your AWS credentials.

export AWS_ACCESS_KEY_ID=ThyFreeFolk
export AWS_SECRET_ACCESS_KEY=YouShallNotPass
export EC2_REGION=ap-southeast-2
export AWS_DEFAULT_REGION=ap-southeast-2

Create a bucket, for example STATE-BUCKET.

Then create your cluster.

kops create cluster \
  --zones=ap-southeast-2a \
  --master-size=t2.small \
  --node-size=t2.medium \
  --node-count=1 \
  --admin-access=0.0.0.0/0 \
  --authorization=AlwaysAllow \
  --cloud=aws \
  --name=YOUR-CLUSTER-NAME \
  --state=s3://STATE-BUCKET
  --yes

Validate cluster

Get cluster credentials

Get admin password

Get token

Upgrade Kubernetes version

Before you begin

Double check your Kops and Kubernetes version compatibility.

Check Kops Compatibility Matrix:

If you don’t know yet, get your cluster’s name:

Let’s suppose your cluster name is my-cluster-name.

Export an environment variable with your cluster name:

Edit cluster’s config:

You cluster’s config will be opened in your text editor. Find and replace the config kubernetesVersion, for example:

From:

To:

Save and exit.

Preview changes:

Apply changes:

Preview update:

Roll update:

Automated update

Alternatively you can run Kops auto update:

Upgrade uses the latest Kubernetes version considered stable by kops, defined in https://github.com/kubernetes/kops/blob/master/channels/stable

References

https://github.com/kubernetes/kops/blob/master/docs/upgrade.md

Last updated