mirror of
https://pagure.io/fedora-docs/quick-docs.git
synced 2024-11-28 06:54:52 +00:00
Remove deleted page
Removes prior kubernetes page.
This commit is contained in:
parent
8611704dcc
commit
06e22af961
1 changed files with 0 additions and 280 deletions
|
@ -1,280 +0,0 @@
|
|||
= Installing Kubernetes on Fedora
|
||||
Bradley G Smith
|
||||
:revnumber: F37,F38,F39,rawhide
|
||||
:revdate: 2023-09-19
|
||||
:category: Installation
|
||||
: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[]
|
||||
|
||||
[overview]
|
||||
== Overview
|
||||
|
||||
This guide describes how to install link:https:/kubernetes.io[Kubernetes] with kubeadm on a Fedora machine using the rpms available from Fedora repositories.
|
||||
The guide also touches on an alternative source for Kubernetes rpms available in COPR and their potential benefit.
|
||||
There is also a brief overview of alternative installation methods.
|
||||
|
||||
[kubernetes-overview]
|
||||
=== 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 computers.
|
||||
Kubernetes had it's genesis in the concepts and principles used at Google to run container-base workloads at scale and with resilience.
|
||||
Kubernetes is now at the center of a vast ecosystem of products and services that aim to help organizations (link:https://cncf.io/[Cloud Native Computing Foundation]).
|
||||
|
||||
There are numerous ways to install and configure Kubernetes depending on purpose and target environment.
|
||||
Is this for a home lab on a single machine, a small cluster for home or business automation, or enterprise scale production workloads in the cloud?
|
||||
This guide is narrowly focused on using dnf and the commandline to install the Kubernetes rpms in Fedora and create a basic cluster using kubeadm.
|
||||
This guide follows the steps in the link:https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/[Creating a cluster with kubeadm] guide.
|
||||
|
||||
[terminology]
|
||||
=== Terminology
|
||||
|
||||
Kubernetes is complex and like many complex systems has it's own terminology. The terminology used in this guide are defined here.
|
||||
The Kubernetes teams maintains a comprehensive link:https://kubernetes.io/docs/reference/glossary/[glossary] which is used in the subset below.
|
||||
|
||||
[horizontal]
|
||||
cluster:: a set of one or more nodes managed as an entity.
|
||||
A cluster has at least one node and one control plane (these can be on the same or separate machines).
|
||||
control plane:: the container orchestration layer in a cluster.
|
||||
At least one nodein a cluster has a control plane.
|
||||
node:: a worker machine (either a virtual machine or physical machine) in Kubernetes that has the services required to run pods.
|
||||
These services include the kubelet container runtime and kube-proxy.
|
||||
pods:: containerized applications are deployed and managed in Kubernetes as pods.
|
||||
A pod is the base object managed by Kuberentes in a cluster.
|
||||
A pod typically has a single primary container but may include more capabilities.
|
||||
|
||||
[install-from-fedora-repository]
|
||||
== Installing Kubernetes from Fedora Repositories
|
||||
|
||||
Each Fedora release has a corresponding Kubernetes release as documented at the link:https://src.fedoraproject.org/rpms/kubernetes[Fedora Package Sources repository for Kubernetes].
|
||||
Fedora 39, for example, has rpms for Kubernetes 1.27.
|
||||
The installation process is the same for all current Fedora releases.
|
||||
These instructions have been tested on Fedora 38 virtual machines and on Raspberry Pi 4 hardware running Fedora 38 minimal.
|
||||
|
||||
|
||||
. Update system with DNF.
|
||||
Reboot if necessary, although a reboot can be deferred until after the next step.
|
||||
+
|
||||
----
|
||||
sudo dnf update
|
||||
----
|
||||
|
||||
. Disable swap.
|
||||
Kubernetes is configured to generate an installation error if swap is detected.
|
||||
Modern Fedora systems use zram by default.
|
||||
Reboot after disabling swap.
|
||||
+
|
||||
----
|
||||
sudo systemctl stop swap-create@zram0
|
||||
sudo dnf remove zram-generator-defaults
|
||||
sudo reboot now
|
||||
----
|
||||
|
||||
. Disable the firewall.
|
||||
Kubernetes is configured to generate an installation error if the firewall is running.
|
||||
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.
|
||||
+
|
||||
----
|
||||
sudo systemctl stop firewalld.system
|
||||
sudo systemctl disable firewalld.system
|
||||
----
|
||||
|
||||
. Install iptables and iproute-tc.
|
||||
+
|
||||
----
|
||||
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/]
|
||||
+
|
||||
----
|
||||
sudo cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
|
||||
overlay
|
||||
br_netfilter
|
||||
EOF
|
||||
----
|
||||
|
||||
. Load the overlay and bridge filter modules.
|
||||
+
|
||||
----
|
||||
sudo modprobe overlay
|
||||
sudo modprobe br_netfilter
|
||||
----
|
||||
|
||||
. Add required sysctl parameters and persist.
|
||||
+
|
||||
----
|
||||
# sysctl params required by setup, params persist across reboots
|
||||
sudo cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
|
||||
net.bridge.bridge-nf-call-iptables = 1
|
||||
net.bridge.bridge-nf-call-ip6tables = 1
|
||||
net.ipv4.ip_forward = 1
|
||||
EOF
|
||||
----
|
||||
|
||||
. Apply sysctl parameters without a reboot.
|
||||
+
|
||||
----
|
||||
sudo sysctl --system
|
||||
----
|
||||
|
||||
. Verify br_filter and overlay modules are loaded.
|
||||
+
|
||||
----
|
||||
lsmod | grep br_netfilter
|
||||
lsmod | grep overlay
|
||||
----
|
||||
|
||||
. Verify that the net.bridge.bridge-nf-call-iptables, net.bridge.bridge-nf-call-ip6tables, and net.ipv4.ip_forward system variables are set to 1 in your sysctl config by running the following command:
|
||||
+
|
||||
----
|
||||
sysctl net.bridge.bridge-nf-call-iptables net.bridge.bridge-nf-call-ip6tables net.ipv4.ip_forward
|
||||
----
|
||||
|
||||
. Install a container runtime.
|
||||
CRI-O is installed in this example.
|
||||
Containerd is also an option.
|
||||
Note: verify that the major:minor version of cri-o is the same as the version of Kubernetes (installed below).
|
||||
On Fedora 38, for example you will need to install cri-o-0:1.26.1-1.fc38.x86_64 to avoid the 1.28 version that is also available.
|
||||
+
|
||||
----
|
||||
sudo dnf install cri-o containernetworking-plugins
|
||||
----
|
||||
|
||||
. Install Kubernetes. This installs the three necessary Kubernetes applications (kubectl, kubelet, and kubeadm) that need to be on each machine in the cluster.
|
||||
+
|
||||
----
|
||||
sudo dnf install kubernetes-client kubernetes-node kubernetes-kubeadm
|
||||
----
|
||||
|
||||
. Start and enable cri-o.
|
||||
+
|
||||
----
|
||||
sudo systemctl enable --now crio
|
||||
----
|
||||
|
||||
. Pull needed system container images for Kubernetes.
|
||||
+
|
||||
----
|
||||
sudo kubeadm config images pull
|
||||
----
|
||||
|
||||
. Start and enable kubelet.
|
||||
Kubelet will be in a crash loop until the cluster is initialized in the next step.
|
||||
+
|
||||
----
|
||||
sudo systemctl enable --now kubelet
|
||||
----
|
||||
|
||||
. Initialize the cluster.
|
||||
+
|
||||
----
|
||||
sudo kubeadm init --pod-network-cidr=10.244.0.0/16
|
||||
----
|
||||
|
||||
. kubeadm will generate output to the terminal tracking initialization steps.
|
||||
If successful, the output below is displayed.
|
||||
At this point there is a cluster running on this single machine.
|
||||
After kubeadm finishes you should see:
|
||||
+
|
||||
----
|
||||
Your Kubernetes control-plane has initialized successfully!
|
||||
|
||||
To start using your cluster, you need to run the following as a regular user:
|
||||
|
||||
mkdir -p $HOME/.kube
|
||||
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
|
||||
sudo chown $(id -u):$(id -g) $HOME/.kube/config
|
||||
|
||||
Alternatively, if you are the root user, you can run:
|
||||
|
||||
export KUBECONFIG=/etc/kubernetes/admin.conf
|
||||
----
|
||||
|
||||
. The steps listed above allow a non-root user to use kubectl, the Kubernetes command line tool. Run these commands now.
|
||||
+
|
||||
----
|
||||
mkdir -p $HOME/.kube
|
||||
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
|
||||
sudo chown $(id -u):$(id -g) $HOME/.kube/config
|
||||
----
|
||||
|
||||
. Allow the control plane machine to also run pods for applications.
|
||||
Otherwise more than one machine is needed in the cluster.
|
||||
+
|
||||
----
|
||||
kubectl taint nodes --all node-role.kubernetes.io/control-plane-
|
||||
----
|
||||
|
||||
. Install flannel into the cluster to provide cluster networking.
|
||||
There are many other networking solutions besides flannel.
|
||||
Flannel is straightforward and suitable for this guide.
|
||||
+
|
||||
----
|
||||
kubectl apply -f https://github.com/coreos/flannel/raw/master/Documentation/kube-flannel.yml
|
||||
----
|
||||
|
||||
. Display list of running pods in the cluster.
|
||||
All pods should display a status of Running.
|
||||
A status of CrashLoopBackOff may show up for the coredns pod.
|
||||
This happens commonly when installing Kubernetes on a virtual machine and the DNS service in the cluster may not select the proper network.
|
||||
Use your favorite internet search engine to find possible solutions.
|
||||
+
|
||||
----
|
||||
kubectl get pods --all-namespaces
|
||||
----
|
||||
|
||||
At this point there is a single machine in the cluster running the control plane and available for work as a node.
|
||||
|
||||
Upgrades to Kubernetes clusters requires care and planning.
|
||||
See link:https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/[Upgrading kubeadm clusters] for more information.
|
||||
|
||||
The xref:dnf.adoc#sect-using-dnf-plugin[DNF Versionlock plugin] is useful in limiting unplanned updates to Kubernetes rpms.
|
||||
Occasionally, the Kuberentes version in a Fedora release reaches end-of-life and a new version of Kubernetes is add to the repositories.
|
||||
Or, an upgrade to Fedora on a cluster machine will also result in a different version of Kubernetes.
|
||||
Once DNF Versionlock is installed, the following command will hold kubernetes rpms and the cri-o rpm at the 1.28 major:minor version but still allow patch updates to occur:
|
||||
----
|
||||
sudo dnf versionlock add kubernetes*-1.28.* cri-o-1.28.*
|
||||
----
|
||||
|
||||
[copr]
|
||||
== Installing Kubernetes from COPR
|
||||
|
||||
// UNVERIFIED
|
||||
|
||||
For this method, please refer to the link:https://github.com/leamas/lpf[`lpf GitHub Page`]
|
||||
requirements.
|
||||
|
||||
. xref:rpmfusion-setup.adoc[Enable the RPMFusion repositories].
|
||||
. Install the `lpf-spotify-client` package:
|
||||
+
|
||||
----
|
||||
sudo dnf install lpf-spotify-client
|
||||
----
|
||||
|
||||
. Install Spotify:
|
||||
.. Click the "lpf-spotify-client" icon in the application list.
|
||||
.. or use the following command in a terminal:
|
||||
+
|
||||
----
|
||||
lpf update
|
||||
----
|
||||
|
||||
[alternatives]
|
||||
== Alternatives
|
||||
|
||||
minikube
|
||||
openshift and okr
|
||||
ansible-based installs such as typhoon
|
||||
|
||||
[references]
|
||||
== References
|
||||
|
||||
. https://kubernetes.io/
|
||||
. https://kubernetes.io/docs/home/
|
||||
. https://kubernetes.io/docs/concepts/overview/
|
Loading…
Reference in a new issue