Project

General

Profile

The ungleich kubernetes infrastructure » History » Version 18

Nico Schottelius, 07/18/2021 04:16 PM

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