diff --git a/modules/ROOT/pages/using-kubernetes.adoc b/modules/ROOT/pages/using-kubernetes.adoc index 69848ca..c5599ed 100644 --- a/modules/ROOT/pages/using-kubernetes.adoc +++ b/modules/ROOT/pages/using-kubernetes.adoc @@ -3,19 +3,20 @@ Bradley G Smith :revnumber: F37,F38,F39,rawhide :revdate: 2023-09-19 :category: Installation -:tags: How-to kubernetes dnf rpm containers +:tags: How-to, kubernetes, dnf, rpm, containers // Optional free form useful additional information as comment //include::{partialsdir}/3rdparty-message.adoc[] include::partial$3rdparty-message.adoc[] +[[sect-overview]] == Overview -This how-to provides an overview of the link:https://kubernetes.io[Kubernetes] rpms in the Fedora repositories, how to use them in a few scenarios and a short installation guide using kubeadm on a Fedora machine. +This how-to provides an overview of the link:https://kubernetes.io[Kubernetes] rpms in the Fedora repositories, how to use them in a few scenarios and a short cluster creation guide using kubeadm on a Fedora machine. The guide also touches on an alternative source for Kubernetes rpms available in COPR and potential benefits. -This guide concludes with a brief overview of a few alternative installation methods applicable to Fedora users. +[[sect-what-is-kubernetes]] === What is Kubernetes? link:https:/kubernetes.io[Kubernetes] is an "open-source system for automating deployment, scaling, and management of containerized applications" on one or more machines. @@ -26,6 +27,7 @@ There are numerous ways to install and configure Kubernetes depending on purpose Is this for a home lab on a single machine, a small cluster for home or business automation, edge-based services and applications in remote offices or enterprise scale production workloads in the cloud? This guide is narrowly focused on the Kubernetes rpms available from Fedora and using dnf and the command line to install these rpms on Fedora and create a basic cluster using kubeadm. +[[sect-terminology]] === Terminology Kubernetes is complex and like many complex systems has it's own terminology. @@ -43,13 +45,14 @@ pods:: containerized applications are deployed and managed in Kubernetes as pods A pod is the base object managed by Kubernetes in a cluster. A pod typically has a single primary container but may include more capabilities. +[[sect-kubernetes-rpms]] == Kubernetes rpms in Fedora The number, name, and organization of content in Fedora Kubernetes rpms depends on the Fedora release. Fedora 40 and newer releases will have one set of rpms. Fedora 39 and older releases have the legacy set of rpms. - +[[sect-fedora-39-and-older]] === Fedora 39 and older releases The table below lists the available Kubernetes rpms in Fedora 39 and older releases, what the rpm contains, and notes on purpose and any restrictions or cautions. @@ -86,24 +89,25 @@ Also installs kubernetes-client. Required on each node. |=== +[[sect-fedora-39-recommendations]] ==== Fedora 39 (and older) Installation recommendations For most modern kubernetes clusters install kubernetes-node, kubernetes-kubeadm, and kubernetes-client on each machine in the cluster. If disk space is a constraint only install kubernetes-client on control-plane machines. -[,bash] +[source,bash] ---- sudo dnf install kubernetes-kubeadm kubernetes-node kubernetes-client ---- If conducting a manual installation of Kubernetes (see link:https://github.com/kelseyhightower/kubernetes-the-hard-way[Kubernetes The Hard Way]) then install kubernetes-master and kubernetes-kubeadm. -[,bash] +[source,bash] ---- sudo dnf install kubernetes-master kubernetes-kubeadm ---- - - +//// +[[sect-fedora40-and-newer]] === Fedora 40 and newer releases Kubernetes rpms have been reorganized starting with Fedora 40 (rawhide in Sept 2023). @@ -134,23 +138,25 @@ Use systemctl to enable kube-proxy on all nodes. Enable kube-apiserver, kube-con |=== +[[sect-fedora-40-recommendations]] ==== Fedora 40 (and newer) installation recommendations For most modern kubernetes clusters install kubernetes, and kubernetes-client on each machine in the cluster. If disk space is a constraint only install kubernetes-client on control-plane machines. -[,bash] +[source,bash] ---- sudo dnf install kubernetes kubernetes-client ---- If conducting a manual installation of Kubernetes (see link:https://github.com/kelseyhightower/kubernetes-the-hard-way[Kubernetes The Hard Way]) then install all kubernetes rpms. -[,bash] +[source,bash] ---- sudo dnf install kubernetes kubernetes-kubeadm kubernetes-control-plane-services kubernetes-node-services kubernetes-client ---- - +//// +[[sect-kubernetes-fedora-crosswalk]] == Kubernetes and Fedora version crosswalk Each Fedora release has a corresponding version of Kubernetes available as listed below. @@ -199,6 +205,7 @@ This guide follows the steps in the link:https://kubernetes.io/docs/setup/produc . Update system with DNF. Reboot if necessary, although a reboot can be deferred until after the next step. + +[source,bash] ---- sudo dnf update ---- @@ -208,6 +215,7 @@ Kubernetes is configured to generate an installation error if swap is detected. Modern Fedora systems use zram by default. Reboot after disabling swap. + +[source,bash] ---- sudo systemctl stop swap-create@zram0 sudo dnf remove zram-generator-defaults @@ -219,6 +227,7 @@ Kubernetes is configured to generate an installation error if the firewall is ru Modern Fedora systems use firewalld. See link:https://devopstales.github.io/kubernetes/k8s-security[https://devopstales.github.io/kubernetes/k8s-security] for an alternative solution that retains the firewall and opens necessary ports. + +[source,bash] ---- sudo systemctl stop firewalld.system sudo systemctl disable firewalld.system @@ -226,6 +235,7 @@ sudo systemctl disable firewalld.system . Install iptables and iproute-tc. + +[source,bash] ---- sudo dnf install iptables iproute-tc ---- @@ -233,6 +243,7 @@ sudo dnf install iptables iproute-tc . Configure IPv4 forwarding and bridge filters. Below copied from link:https://kubernetes.io/docs/setup/production-environment/container-runtimes/[https://kubernetes.io/docs/setup/production-environment/container-runtimes/] + +[source,bash] ---- sudo cat <