/kubectl-provision

Experimental `kubectl` (Kubernetes CLI) plugin which provisions a node with `kubeadm` from zero.

Primary LanguageGoApache License 2.0Apache-2.0

kubectl provision (experimental)

Experimental kubectl (Kubernetes CLI) plugin which provisions an node with kubeadm from zero.

Why

It's best practice to manage server configurations with some configuration management tool (Ansible, etc.), but sometimes you just want to connect an existing server to Kubernetes cluster quickly and easily. kubeadm do the heavy job for joining the node to the cluster, but before that, you need to install container runtime, kubelet and kubeadm.

How it works

kubectl provision node will:

  1. Install required packages (runtime, kubelet, kubeadm)
  2. Get Kubernetes bootstrap token
  3. Joins the node to the target cluster with kubeadm.

Install

MacOS with Brew

brew install rsync ernoaapa/kubectl-plugins/provision

Linux / MacOS without Brew

  1. Install rsync with your preferred package manager
  2. Download kubectl-provision binary from releases
  3. Add it to your PATH

Usage

When the plugin binary is found from PATH you can just execute it through kubectl CLI

kubectl provision node --help

Development

Prerequisites

Build and run against Vagrant

Prerequisites

You need to have following flags in your Kubernetes master to be able to join with bootstrap tokens

# kube-apiserver
--enable-bootstrap-token-auth=true

# kube-controller-manager
--controllers=*,bootstrapsigner,tokencleaner

Start the test node

vagrant up

Install and join the Vagrant VM to your Kubernetes cluster

go run ./main.go node -- -F =(vagrant ssh-config) node-1