infrapuzzle/bootstrap
Moritz Graf a420e03ef3 reinit with flannel 2020-04-05 12:23:09 +02:00
..
.gitignore Switching to better vagrant initscript 2020-02-16 13:52:08 +01:00
README.md reinit with flannel 2020-04-05 12:23:09 +02:00
dev.ini Working k8s cluster 2020-04-04 12:18:18 +02:00
init.sh reinit with flannel 2020-04-05 12:23:09 +02:00
prod.ini Working k8s cluster 2020-04-04 12:18:18 +02:00

README.md

Bootstrap

The following lines document how to initalize a fresh cluster. On a real cluster, or using Vagrant. It therefore assumes to clone kubespray to this folder. It will be excluded in .gitignore and all files are in this folder.

Vagrant

./init.sh
cd kubespray
vagrant up
# up and abkle to ssh
vagrant ssh k8s-1

Prod

Prepare server:

ssh centos@<ip>
# auth via pw
sudo su - root
adduser moritz
visudo # add as sudo user
sudo yum -y install vim python3
ssh-keygen
vim .ssh/authorized_users # paste key
chmod 644 .ssh/authorized_users
# check whether login works with ssh key
sudo vim /etc/ssh/sshd_config # remove pw auth & root login
sudo yum upgrade -y && sudo reboot

Install Kubernetes:

$ ./init.sh
$ # follow instructions from output, sth like:
$ cd kubespray                                                                                                                                          │nginx-ingress-default-backend-5b967cf596-sk7p7   1/1     Running   0          22h
$ ansible-playbook -i inventory/prod/inventory.ini cluster.yml    

And get credentials:

ssh <ip>
sudo su - root
cd
cp -r .kube /home/moritz/
chown -R moritz. /home/moritz/.kube
#ctrl + d
kubectl get ns # test connection
#ctrl + d
scp haumdaucher.de:/home/moritz/.kube/config .kube/config

Foreward in k8s-directory.