Project

General

Profile

The ungleich kubernetes infrastructure » History » Version 27

Nico Schottelius, 08/14/2021 07:16 PM

1 22 Nico Schottelius
h1. The ungleich kubernetes infrastructure and ungleich kubernetes manual
2 1 Nico Schottelius
3 3 Nico Schottelius
{{toc}}
4
5 1 Nico Schottelius
h2. Status
6
7 22 Nico Schottelius
This document is **pre-production**. This document is to become the ungleich kubernetes infrastructure overview as well as the ungleich kubernetes manual.
8 1 Nico Schottelius
9 10 Nico Schottelius
h2. k8s clusters
10
11 26 Nico Schottelius
| Cluster     | Purpose       |
12
| c0.k8s.ooo  | Dev           |
13
| c1.k8s.ooo  | Dev p6        |
14
| c2.k8s.ooo  | Demo/Semiprod |
15
| c3.k8s.ooo  | Dev p6        |
16
| c4.k8s.ooo  | active-dev p7 |
17
| p6.k8s.ooo  | planned       |
18
| p10.k8s.ooo | production    |
19 25 Nico Schottelius
20
Typical init procedure:
21
22
* Single control plane: @kubeadm init --config bootstrap/XXX/kubeadm.yaml@
23
* Multi control plane (HA): @kubeadm init --config bootstrap/XXX/kubeadm.yaml --upload-certs@
24 21 Nico Schottelius
25 1 Nico Schottelius
h2. General architecture and components overview
26
27
* All k8s clusters are IPv6 only
28
* We use BGP peering to propagate podcidr and serviceCidr networks to our infrastructure
29 27 Nico Schottelius
* The main public testing repository is "ungleich-k8s":https://code.ungleich.ch/ungleich-public/ungleich-k8s
30
** Private configurations are found in the **k8s-config** repository
31 1 Nico Schottelius
32 23 Nico Schottelius
h2. ungleich kubernetes infrastructure v1
33 1 Nico Schottelius
34
We are using the following components:
35
36
* "Calico as a CNI":https://www.projectcalico.org/ with BGP, IPv6 only, no encapsulation
37 18 Nico Schottelius
** Needed for basic networking
38 1 Nico Schottelius
* "kubernetes-secret-generator":https://github.com/mittwald/kubernetes-secret-generator for creating secrets
39 18 Nico Schottelius
** Needed so that secrets are not stored in the git repository, but only in the cluster
40
* "ungleich-certbot":https://hub.docker.com/repository/docker/ungleich/ungleich-certbot 
41
** Needed to get letsencrypt certificates for services
42 2 Nico Schottelius
* "rook with ceph rbd + cephfs":https://rook.io/ for storage
43 1 Nico Schottelius
** rbd for almost everything, *ReadWriteOnce*
44
** cephfs for smaller things, multi access *ReadWriteMany*
45 18 Nico Schottelius
** Needed for providing persistent storage
46
* "flux v2":https://fluxcd.io/ 
47
** Needed to manage resources automatically
48
49 3 Nico Schottelius
50 8 Nico Schottelius
h3. Persistent storage setup 
51
52
* 3 or 5 monitors
53
54 9 Nico Schottelius
h3. Cluster types
55 1 Nico Schottelius
56 9 Nico Schottelius
| **Type/Feature** | **Development** | **Production** |
57
| Min No. nodes | 3 (1 master, 3 worker) | 5 (3 master, 3 worker) |
58
| Recommended minimum | 4 (dedicated master, 3 worker) | 8 (3 master, 5 worker) |
59
| Separation of control plane | optional | recommended |
60
| Persistent storage | required | required |
61
| Number of storage monitors | 3 | 5 |
62 10 Nico Schottelius
63
h2. Operations
64
65
h3. Installing a new k8s cluster
66
67
* Decide on the cluster name (usually *cX.k8s.ooo*), X counting upwards
68
* Use cdist to configure the nodes with requirements like crio
69
* Decide between single or multi node control plane setups (see below)
70
* Setup DNS delegation and glue records:
71
** kube-dns.kube-system.svc.cX AAAA ...
72
** kube-dns.kube-system.svc.cX A ...
73
** cX NS kube-dns.kube-system.svc.cX
74
75 9 Nico Schottelius
76 8 Nico Schottelius
77 3 Nico Schottelius
h2. Open Issues / To be discussed
78
79
* "Maybe add Autoscaling support?":https://github.com/kubernetes-sigs/metrics-server
80
** https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
81
** https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler/
82
* Certainly deploy in-cluster monitoring
83
** "prometheus-operator":https://github.com/prometheus-operator/prometheus-operator CR
84
** "kube-prometheus":https://github.com/prometheus-operator/kube-prometheus complete example, based on prometheus-operator
85 4 Nico Schottelius
** "kubernetes dashboard":https://github.com/kubernetes/dashboard generic cluster overview, basically kubectl for a broswer + graphs
86 5 Nico Schottelius
** "kube-prometheus-stack via helm":https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack#kube-prometheus-stack
87
*** Looks most fitting, testing it in #9468
88 7 Nico Schottelius
* Matrix/Notification bot
89
** Informing about changes in the cluster