Kops commands

March 7, 2019

Quick commands for Kops.

First set the environment variable $NAME and KOPS_STATE_STORE.

$ export NAME=kubernetes-cluster.example.com
$ export KOPS_STATE_STORE=s3://kops

Get kubecfg

You can export a kubecfg file for a cluster from the state store. The config will be save in ~/.kube/conf, after that you can use the command kubectl.

$ kops export kubecfg $NAME 

Get cluster config

$ kops get --name $NAME -o yaml

Edit cluster

You can download the current configuration to your computer and edit with some text editor, also this method allow to you to modified the instances groups for the master and nodes.

$ kops get --name $NAME -o yaml > kops.yml
$ vi kops.yml
$ kops replace -f kops.yml
$ kops update cluster $NAME
$ kops rolling-update cluster $NAME

# Rolling update only AWS layer.
# This helps if you lose connectivity with the Kubernetes API.
$ kops rolling-update cluster --cloudonly --force

The commands for update and rolling-update runs as dry-run, you need to add --yes to apply the configuration.