Build
kubash build - builds images by default using packer.
SSH keys
ssh keys can be added to the `authorized_keys` on the hosts, either by setting the key as an environment variable directly as:
KEYS_TO_ADD='ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTY68No= adminuser@testbox'
Or alternatively give it an url to a set of pubkeys:
KEYS_URL='https://raw.githubusercontent.com/myorg/keys/master/keys'
Builder options
The builder can be set with the --builder option for now there are only packer and coreos builders. i.e.
`--builder packer` This will build images using packer
`--builder coreos` This will download the official coreos images
OS options
The OS to build can be set with --target-os option
`--target-os ubuntu` This will build ubuntu images
`--target-os debian` This will build debian images
`--target-os fedora` This will build fedora images
`--target-os centos` This will build centos images
`--target-os coreos` This will build coreos images (* no packer build for this*)
Initializer specific builds
There are a few OS builds that are built specifically for some of the initializers. `--target-os kubeadm` This will build centos images with the addition of getting the kube repos added and kubeadm etc installed
`--target-os kubeadm2ha` This will build centos images with the addition of prepping for the kubeadm2ha ansible playbook
`--target-os kubespray` This will build centos images with the addition of prepping for the kubespray ansible playbook
`--target-os openshift` This will build centos images with the addition of prepping for the openshift ansible playbook
Target build
For the packer build you can specify alternate json files to use
`--target-build my-alternate.json` This must exist in `$KUBASH_DIR/pax/$target_os/my-alternate.json`
For the coreos option this sets the channel (stable,beta,alpha)
`--target-build beta`
For more information see the build documentation page.
Provision
kubash provision - provisions virtual machines by default using qemu/KVM to then rebase the image built during the build step for your nodes. The image is first hardlinked to a named image for your cluster so that subsequent builds will not overwrite your running clusters base image. Then that image is copied in parallel using rsync to all provisioning hosts. Finally the machines are spun up, provisioned, and your ssh known_hosts and hosts.csv is repopulated.
After which you will have 6 new VMs, 3 masters, and 3 nodes.
This can be altered by creating your own cluster yaml file. There is an example file. in the repo.
For more information see the provision documentation page..
Init
kubash init - initialize kubernetes cluster by default using kubeadm.
Optionally there are alternative initializers you can try using the '--initializer' option (right now kubespray, openshift, kubeadm2ha are available).
The default method was conceived as I gathered official documentation into simple shell scripts and it grew into it's current state quite organically.
One of the final resources that finally made the multimaster setup start working was this google doc.
Which is the same author of the kubeadm2ha ansible playbook used in that intializer above.
For more information see the init documentation page..
Interactive
kubash - is an interactive shell for your clusters.
At this prompt you can invoke all the kubash commands in a read loop, this can eliminate a fair amount of typing while interacting with a cluster. There are a few special commands that you can invoke in the interactive shell. `use EXAMPLE` will set the name of the cluster that you are interacting with. `verbosity 10` will set the verbosity to 10. `v` will increment the verbosity up one.
Helm can be used as well from the K8$ shell try 'helm search prometheus'.
Or by shorthand `h search prometheus`
There are also many shortcuts for using kubectl directly from the K8$ shell.
K8$ help
commands:
help - show this help
kh|khelp - show the kubectl help
build - build a base image
provision - provision individual nodes
init - initialize the cluster
reset - reset the cluster with `kubeadm reset` on all hosts
decommission - tear down the cluster and decommission nodes
show - show the analyzed input of the hosts file
ping - Perform ansible ping to all hosts
auto - Full auto will provision and initialize all hosts
masters - Perform initialization of masters
nodes - Perform initialization of nodes
dotfiles - Perform dotfiles auto configuration
grab - Grab the .kube/config from the master
hosts - Write ansible hosts file
copy - copy the built images to the provisioning hosts
k * - k commands will attempt to be passed to kubectl
h * - h commands will attempt to be passed to helm
i.e.
get pods
get nodes
etc
K8$ khelp
kubectl shorthand commands: # Drop into an interactive terminal on a container
keti="kubectl exec -ti"
# Pod management.
kgp="kubectl get pods"
kgpa="kubectl get pods --all-namespaces"
klp="kubectl logs pods"
kep="kubectl edit pods"
kdp="kubectl describe pods"
kdelp="kubectl delete pods"
# Service management.
kgs="kubectl get svc"
kes="kubectl edit svc"
kds="kubectl describe svc"
kdels="kubectl delete svc"
# Secret management
kgsec="kubectl get secret"
kdsec="kubectl describe secret"
kdelsec="kubectl delete secret"
# Deployment management.
kgd="kubectl get deployment"
ked="kubectl edit deployment"
kdd="kubectl describe deployment"
kdeld="kubectl delete deployment"
ksd="kubectl scale deployment"
krsd="kubectl rollout status deployment"
# Rollout management.
kgrs="kubectl get rs"
krh="kubectl rollout history"
kru="kubectl rollout undo"
For more information see the interactive documentation page.