What does HackerNews think of kubespray?

Deploy a Production Ready Kubernetes Cluster

Language: Jinja

#3 in Ansible
#93 in Hacktoberfest
#22 in Kubernetes
You could do that with Ansible, there's kubespray [0] from the official project to do that. You may want to read [1] starting with [2]. There's also k3s [0] and k0s [4]. I've written about my setup here [5] also if you are interested.

[0]: https://github.com/kubernetes-sigs/kubespray

[1]: https://www.tauceti.blog/

[2]: https://www.tauceti.blog/posts/kubernetes-the-not-so-hard-wa...

[3]: https://k3s.io/

[4]: https://k0sproject.io/

[5]: https://vmarchaud.fr/deploying-kubernetes-the-hard-way/

One disadvantage of k3s, is that it does not have HA control plane out of box (specifically, users are expected to bring their own HA database solution[1]). Without that, losing the single point of failure control plane node is going to give you a very bad day.

I use kubespray[2] to manage my raspberry pi based k8s homelab, and replacing any nodes, including HA control plane nodes, is as easy as swapping the board and executing an ansible playbook. The downsides of this, are that it requires the users to have more knowledge about operating k8s, and a single ansible playbook run takes 30-40 minutes...

1. https://rancher.com/docs/k3s/latest/en/installation/ha/

2. https://github.com/kubernetes-sigs/kubespray

Rancher was the last independent kubernetes distribution (that was company backed) as far as I can tell.

There was also CoreOS, which has since been bought by RedHat, and Deis, since bought by Microsoft.

So now it's been turned back into an OS war. RedHat, SuSE, and Microsoft.This is fitting because kubernetes feels like an operating system for container clusters. After all, operating systems are just resource managers and schedulers like kubernetes is.

(For those interested, there are several kubernetes distributions that are not company backed and open source. Two of my favorites are Kubespray[1] and Typhoon[2].)

1: https://github.com/kubernetes-sigs/kubespray 2: https://typhoon.psdn.io/

Step 1. Setup vagrant

Step 2: Update /etc/hosts on all the nodes vagrant@amaster:~$ sudo vi /etc/hosts 100.0.0.1 amaster.jhooq.com amaster 100.0.0.2 kmaster.jhooq.com kmaster 100.0.0.3 kworker.jhooq.com kworker

Step 3: Generate SSH key for ansible vagrant@amaster:~$ ssh-keygen -t rsa

Step 4: Copy SSH key to other nodes vagrant@amaster:~$ ssh-copy-id 100.0.0.2 vagrant@amaster:~$ ssh-copy-id 100.0.0.3

Step 5: Install python3-pip vagrant@amaster:~$ sudo apt install python3-pip

Step 6: Clone the kubespray git repo vagrant@amaster:~$ git clone https://github.com/kubernetes-sigs/kubespray.git

Step 7: Install kubespray package vagrant@amaster:~/kubespray$ sudo pip3 install -r requirements.txt

Step 8: Copy inventory file to current users vagrant@amaster:~/kubespray$ cp -rfp inventory/sample inventory/mycluster

Step 9: Prepare host.yml for kubespray vagrant@amaster:~/kubespray$ declare -a IPS=(100.0.0.2 100.0.0.3)

vagrant@amaster:~/kubespray$ CONFIG_FILE=inventory/mycluster/hosts.yml python3 contrib/inventory_builder/inventory.py ${IPS[@]}

Step 10: Run the ansible-playbook on ansible node ansible-playbook -i inventory/mycluster/hosts.yml --become --become-user=root cluster.yml

Step 11: Install kubectl on kubernetes master vagrant@node1:~$ curl -LO https://storage.googleapis.com/kubernetes-release/release/`c... -s https://storage.googleapis.com/kubernetes-release/release/st...

vagrant@node1:~$ sudo cp /etc/kubernetes/admin.conf /home/vagrant/config vagrant@node1:~$ mkdir .kube vagrant@node1:~$ mv config .kube/ vagrant@node1:~$ sudo chown $(id -u):$(id -g ) $HOME/.kube/config

Step 12: Verify the kubernetes nodes vagrant@node1:~$ kubectl get nodes NAME STATUS ROLES AGE VERSION node1 Ready master 13m v1.18.2 node2 Ready master 13m v1.18.2