reinit with flannel

This commit is contained in:
Moritz Graf 2020-04-05 12:23:09 +02:00
parent 693e361821
commit a420e03ef3
2 changed files with 45 additions and 12 deletions

View File

@ -1,23 +1,57 @@
# Bootstrap
The following lines document hwo 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.
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
```sh
git clone https://github.com/kubernetes-sigs/kubespray.git
#git clone git@github.com:iptizer/kubespray.git
./init_kubespray.sh
./init.sh
cd kubespray
vagrant up
# up and abkle to ssh
vagrant ssh k8s-1
```
TODO 16.02.2020: Vagrant up works but no k8s is installed. Maybe due to wrong ansible playbook or because from here on kubespray should kick in
## Prod
## Done steps
The following steps have been done while first setup and are not required to be redone:
Prepare server:
```sh
cp ./kubespray/Vagrantfile .
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:
```sh
$ ./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:
```sh
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.

View File

@ -40,6 +40,5 @@ echo "## Preparing real prod environment"
cp -r kubespray/inventory/sample kubespray/inventory/prod
rm kubespray/inventory/prod/inventory.ini
cp ./prod.ini kubespray/inventory/prod/inventory.ini
echo "to deploy execute:"
echo "$ cd kubespray"
echo "$ ansible-playbook -i inventory/prod/inventory.ini cluster.yml"
gsed -i "s/kube_network_plugin: .*/kube_network_plugin: flannel/" ./kubespray/inventory/prod/group_vars/k8s-cluster/k8s-cluster.yml
gsed -i "s/metrics_server_enabled: .*/metrics_server_enabled: true/" ./kubespray/inventory/prod/group_vars/k8s-cluster/addons.yml