Use Chef and kubeadm to manage a Kubernetes cluster.
-
Spin up some instances where you want to run kubernetes
-
Add ssh aliases to
~/.ssh/config
for each of those nodes, e.g.Host k8s-master HostName 1.2.3.4 User root IdentityFile ~/.ssh/digitalocean Host k8s-node HostName 1.2.3.5 User root IdentityFile ~/.ssh/digitalocean
-
Install Knife Solo so you can use Chef without having to setup a Chef server
apt-get install gnupg2 gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 \curl -L https://get.rvm.io | bash -s stable --ruby source /usr/local/rvm/scripts/rvm rvm install "ruby-2.3.1" gem install chef gem install knife-solo gem install librarian-chef gem install berkshelf knife solo init .
-
Open "k8s cookbooks data bag secret" from 1password and copy the password to your clipboard.
-
Write the data bag secret key to disk so you can access encrypted secrets
$ pbpaste > .chef/data_bag_secret_file
-
Bootstrap your master node:
$ knife solo prepare k8s-master $ knife solo cook k8s-master --override-runlist "k8s::setup-master"
-
Bootstrap your minion node(s) (run this for each node)
$ knife solo prepare k8s-node $ knife solo cook k8s-node --override-runlist "k8s::setup-node"
-
Verify that your nodes are registered with the master
$ ssh k8s-master $ su ubuntu $ kubectl get nodes