Initializing the Kubernetes cluster: Difference between revisions

From Collective Computational Unit
Jump to navigation Jump to search
Line 1: Line 1:
== Master node from scratch ==
== Kubernetes and pre-requisites ==


* Install Kubernetes on Ubuntu 18.04. Assuming version 1.14.2 is pulled, check how to fix version.
Install Kubernetes on Ubuntu 18.04. Assuming version 1.14.2 is pulled, check how to fix version.


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
Line 8: Line 8:
</syntaxhighlight>
</syntaxhighlight>


* Set up other pre-requisites:
Reconfigure docker runtime. Edit /etc/docker/daemon.json as follows:
** Reconfigure docker runtime. Edit /etc/docker/daemon.json as follows:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
{
{
Line 20: Line 19:
}
}
</syntaxhighlight>
</syntaxhighlight>
** Restart docker daemon:
 
Restart docker daemon:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
> mkdir -p /etc/systemd/system/docker.service.d
> mkdir -p /etc/systemd/system/docker.service.d
Line 27: Line 27:
</syntaxhighlight>
</syntaxhighlight>


** Make sure swap is off
Make sure swap is off
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
> sudo swapoff -a
> sudo swapoff -a
Line 33: Line 33:
Check /etc/fstab if swap is still configured there, delete if this is the case.
Check /etc/fstab if swap is still configured there, delete if this is the case.


* Create cluster configuration scripts.
== Create cluster configuration scripts ==
 
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
> cd init/templates
> cd init/templates
Line 44: Line 45:
This will generate the init config from the config template and store it in /home/kubernetes/clusters/ccu.
This will generate the init config from the config template and store it in /home/kubernetes/clusters/ccu.


* Spin up the master node.
 
== Spin up the master node ==


Use kubeadm with the generated config to initialize the control plane.
Use kubeadm with the generated config to initialize the control plane.
Line 53: Line 55:
> sudo kubeadm init --config kubeadm-init-config.yaml
> sudo kubeadm init --config kubeadm-init-config.yaml
</syntaxhighlight>
</syntaxhighlight>
If this fails at any point, use kubeadm reset after problems have been fixed before trying to re-initialize.





Revision as of 13:38, 14 June 2019

Kubernetes and pre-requisites

Install Kubernetes on Ubuntu 18.04. Assuming version 1.14.2 is pulled, check how to fix version.

> cd init
> ./install_kubernetes.sh

Reconfigure docker runtime. Edit /etc/docker/daemon.json as follows:

{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2"
}

Restart docker daemon:

> mkdir -p /etc/systemd/system/docker.service.d
> systemctl daemon-reload
> systemctl restart docker

Make sure swap is off

> sudo swapoff -a

Check /etc/fstab if swap is still configured there, delete if this is the case.

Create cluster configuration scripts

> cd init/templates
# edit cluster information in the following config file
> nano make_init_config.sh
> touch /home/kubernetes/.rnd
> ./make_init_config.sh

This will generate the init config from the config template and store it in /home/kubernetes/clusters/ccu.


Spin up the master node

Use kubeadm with the generated config to initialize the control plane.

> cd /home/kubernetes/clusters/ccu
> sudo systemctl enable docker.service
> sudo kubeadm init --config kubeadm-init-config.yaml

If this fails at any point, use kubeadm reset after problems have been fixed before trying to re-initialize.


  • Flannel daemonset (node communication)
  • nVidia daemonset
  • Update kubelet configuration for master node

Authentication systems

DEX with LDAP

TODO: outdated, switched to containerized DEX. Check what still needs to be done.

Set up according to this tutorial with customized install scripts in kubernetes/init/dex/

  1. Create secrets for TLS connections, use certs for ccu.uni-konstanz.de
    1. Modify ca-cm.yml to contain correct ca.
    2. Run upload_ccu_tls.sh
  2. Spin up login application service.
    1. Modify loginapp-cm.yml: server config
    2. Modify loginapp-ing-srv.yml: service data, mapping of ports to outside world
    3. Modify loginapp-deploy.yml: ID secret for TLS
    4. Run start-login-service.sh
  3. Spin up dex
    1. Modify dex-cm.yml: server data and LDAP configuration
    2. Modify dex-ing-srv.yml: service data, mapping of ports to outside world
    3. Modify dex-deploy.yml: ID secret for TLS
    4. Run start-dex-service.sh