Cheat Sheet
Useful Kops tricks.
source <(kops completion bash)
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
This setup is not suitable for production environments.
admin-access
and authorization
are wide open.Validate cluster
kops validate cluster
kops get secrets kube --type secret -oplaintext
kubectl -n kube-system \
describe secret \
$(kubectl -n kube-system \
get secret | awk '/^deployment-controller-token-/{print $1}') | \
awk '$1=="token:"{print $2}'
Double check your Kops and Kubernetes version compatibility.
DO NOT upgrade to a Kubernetes version unsuported by your Kops version
Check Kops Compatibility Matrix:
If you don’t know yet, get your cluster’s name:
kubectl config get-clusters
Let’s suppose your cluster name is my-cluster-name.
Export an environment variable with your cluster name:
export NAME=my-cluster-name
Edit cluster’s config:
kops edit cluster $NAME
You cluster’s config will be opened in your text editor. Find and replace the config kubernetesVersion, for example:
From:
kubernetesVersion: 1.6.0
To:
kubernetesVersion: 1.9.9
Save and exit.
Preview changes:
kops update cluster $NAME
Apply changes:
kops update cluster $NAME --yes
Preview update:
kops rolling-update cluster $NAME
Roll update:
kops rolling-update cluster $NAME --yes
Alternatively you can run Kops auto update:
kops upgrade cluster $NAME
kops upgrade cluster $NAME --yes
kops update cluster $NAME
kops update cluster $NAME --yes
Upgrade uses the latest Kubernetes version considered stable by kops, defined in https://github.com/kubernetes/kops/blob/master/channels/stable
Last modified 4yr ago