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