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