Kops: Fully Scripted Creation?

Created on 15 Feb 2017  路  4Comments  路  Source: kubernetes/kops

Is there a way to fully script the creation of a cluster with Kops? Each time I've created a cluster, I've edited part of the default install with kops edit cluster ${NAME} and the like.

aredocumentation

Most helpful comment

@tothandras That is basically correct. I forgot to mention that you at least need to create the sshpublickey secret. As a general outline as to how one might think about the logic needed to script this, consider the following:

First I will kops create -f <clusters_spec with instance groups>.

Then I will kops create secret --name <clustername> sshpublickey admin -i ~/.ssh/key.pub.

Then kops update cluster $CLUSTER_NAME --yes.

Then I can use kops validate cluster $CLUSTER_NAME.

And when I see that the cluster is ready, I would have a script that would apply any add-ons that you may need to consider the cluster fully bootstrapped. kops take a sort of hands off approach the add-ons. It makes them available for you, but doesn't apply them automatically.

All 4 comments

A bit tricky IMHO, you basically override EDITOR variable with your own script.

You can look at how prometheus guys doing it (https://github.com/prometheus/prombench)

@pluttrell Take a look at: https://github.com/kubernetes/kops/blob/master/docs/cli/kops_create.md

kops create -f FILENAME will let you predefine a kops cluster spec and then create it in one scripted action. One little trick that I think may not (yet!) be fully documented, you need a cluster spec AND the instance group specs to fully create the cluster.

You can get example cluster and IG specs by using:
kops get cluster -o yaml --full and kops get instancegroups <instancegroup> -o yaml.

I think this is basically a documentation issue, so I'm going to close it and cross-reference some of the open docs issues that this is related to. If you have any further questions, please check out the kubernetes slack, #kops channel.

Related issues: #1732, #1735, #267, #752

@geojaz Is it the expected behaviour that kops create -f FILENAME doesn't create the certificates, addons?
image

@tothandras That is basically correct. I forgot to mention that you at least need to create the sshpublickey secret. As a general outline as to how one might think about the logic needed to script this, consider the following:

First I will kops create -f <clusters_spec with instance groups>.

Then I will kops create secret --name <clustername> sshpublickey admin -i ~/.ssh/key.pub.

Then kops update cluster $CLUSTER_NAME --yes.

Then I can use kops validate cluster $CLUSTER_NAME.

And when I see that the cluster is ready, I would have a script that would apply any add-ons that you may need to consider the cluster fully bootstrapped. kops take a sort of hands off approach the add-ons. It makes them available for you, but doesn't apply them automatically.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

justinsb picture justinsb  路  4Comments

argusua picture argusua  路  5Comments

georgebuckerfield picture georgebuckerfield  路  4Comments

rot26 picture rot26  路  5Comments

austinmoore- picture austinmoore-  路  5Comments