⎈ k8s knowledge compiler

Running Kubelet in Standalone Mode [page]deterministic

tutorials

This tutorial shows you how to run a standalone kubelet instance.

You may have different motivations for running a standalone kubelet. This tutorial is aimed at introducing you to Kubernetes, even if you don't have much experience with it. You can follow this tutorial and learn about node setup, basic (static) Pods, and how Kubernetes manages containers.

Once you have followed this tutorial, you could try using a cluster that has a [control plane](#gloss:control-plane) to manage pods and nodes, and other types of objects. For example, [Hello, minikube](/docs/tutorials/hello-minikube/).

You can also run the kubelet in standalone mode to suit production use cases, such as to run the control plane for a highly available, resiliently deployed cluster. This tutorial does not cover the details you need for running a resilient control plane.

##

* Install `cri-o`, and `kubelet` on a Linux system and run them as `systemd` services. * Launch a Pod running `nginx` that listens to requests on TCP port 80 on the Pod's IP address. * Learn how the different components of the solution interact among themselves.

The kubelet configuration used for this tutorial is insecure by design and should _not_ be used in a production environment.

##

* Admin (`root`) access to a Linux system that uses `systemd` and `iptables` (or nftables with `iptables` emulation). * Access to the Internet to download the components needed for the tutorial, such as: * A [container runtime](#gloss:container-runtime) that implements the Kubernetes [(CRI)](#gloss:cri). * Network plugins (these are often known as [Container Networking Interface (CNI)](#gloss:cni)) * Required CLI tools: `curl`, `tar`, `jq`.

## Prepare the system

### Swap configuration

By default, kubelet fails to start if swap memory is detected on a node. This means that swap should either be disabled or tolerated by kubelet.

If you configure the kubelet to tolerate swap, the kubelet still configures Pods (and the containers in those Pods) not to use swap space. To find out how Pods can actually use the available swap, you can read more about [swap memory management](/docs/concepts/architecture/nodes/#swap-memory) on Linux nodes.

If you have swap memory enabled, either disable it or add `failSwapOn: false` to the kubelet configuration file.

To check if swap is enabled:

```shell sudo swapon --show ```

If there is no output from the command, then swap memory is already disabled.

To disable swap temporarily:

```shell sudo swapoff -a ```

To make this change persistent across reboots:

Make sure swap is disabled in either `/etc/fstab` or `systemd.swap`, depending on how it was configured on your system.

### Enable IPv4 packet forwarding

To check if IPv4 packet forwarding is enabled:

```shell cat /proc/sys/net/ipv4/ip_forward ```

If the output is `1`, it is already enabled. If the output is `0`, then follow next steps.

To enable IPv4 packet forwarding, create a configuration file that sets the `net.ipv4.ip_forward` parameter to `1`:

```shell sudo tee /etc/sysctl.d/k8s.conf <<EOF net.ipv4.ip_forward = 1 EOF ```

Apply the changes to the system:

```shell sudo sysctl --system ```

The output is similar to:

``` ... * Applying /etc/sysctl.d/k8s.conf ... net.ipv4.ip_forward = 1 * Applying /etc/sysctl.conf ... ```

## Download, install, and configure the components

### Install a container runtime {#container-runtime}

Download the latest available versions of the required packages (recommended).

This tutorial suggests installing the [CRI-O container runtime](https://github.com/cri-o/cri-o) (external link).

There are several [ways to install](https://github.com/cri-o/cri-o/blob/main/install.md) the CRI-O container runtime, depending on your particular Linux distribution. Although CRI-O recommends using either `deb` or `rpm` packages, this tutorial uses the _static binary bundle_ script of the [CRI-O Packaging project](https://github.com/cri-o/packaging/blob/main/REA …(trimmed)

Sources

tutorials/cluster-management/kubelet-standalone.md · docRunning Kubelet in Standalone Mode

Related (25)

references Control Planecontrol plane conf=1
references Container Runtimecontainer runtime conf=1
references Container Runtime Interface (CRI)(CRI) conf=1
references Container network interface (CNI)Container Networking Interface (CNI) conf=1
references ConfigMapConfigMap conf=1
references SecretSecret conf=1
part_of {{% heading "objectives" %}}describes conf=1
part_of {{% heading "prerequisites" %}}describes conf=1
part_of Prepare the systemdescribes conf=1
part_of Run a Pod in the kubeletdescribes conf=1
part_of Where to look for more detailsdescribes conf=1
part_of Clean updescribes conf=1
part_of Conclusiondescribes conf=1
part_of {{% heading "whatsnext" %}}describes conf=1
part_of Swap configurationdescribes conf=1
part_of Enable IPv4 packet forwardingdescribes conf=1
part_of Set up CRI-O {#cri-o-setup}describes conf=1
part_of Install network pluginsdescribes conf=1
part_of Download and set up the kubeletdescribes conf=1
part_of kubeletdescribes conf=1
part_of Container runtimedescribes conf=1
part_of Network pluginsdescribes conf=1

← all Docs