# worker cluster

**Step 1: Prepare the System**

* Configure kernel modules by creating a configuration file:

```yaml
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF

```

Load the required kernel modules:

```
sudo modprobe overlay
sudo modprobe br_netfilter
sudo sysctl --system

```

**Step 2: Install Container Runtimes**

* Add Docker's official GPG key:

```
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

```

Add the Docker repository to Apt sources:

```
echo \
  "deb [arch=\$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  \$(. /etc/os-release && echo "\$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

```

Install containerd.io:

```
sudo apt-get install containerd.io

```

**Step 3: Install Container Networking Plugins**

* Download and install CNI plugins:

```
wget https://github.com/containernetworking/plugins/releases/download/v1.3.0/cni-plugins-linux-amd64-v1.3.0.tgz
mkdir -p /opt/cni/bin
tar -C /opt/cni/bin -xzvf cni-plugins-linux-amd64-v1.3.0.tgz

```

Edit the containerd configuration:

```
nano /etc/containerd/config.toml

```

Add the following configuration under

```
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
SystemdCgroup = true
```

> You need CRI support enabled to use containerd with Kubernetes. Make sure that `cri` is not included in the`disabled_plugins` list within `/etc/containerd/config.toml`;

Restart containerd:

```
sudo systemctl restart containerd

```

**Step 4: Install Kubernetes Tools**

* Install necessary tools and set up the Kubernetes repository:

```
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl

sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg

echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update

```

List available versions of kubeadm:

```
sudo apt list -a kubeadm
```

Install kubeadm, kubelet, and kubectl (replace 1.28.0 with your desired version):

```
sudo apt-get install kubeadm=1.28.0-00
sudo apt-get install kubelet=1.28.0-00
```

After completing this process, you now have your worker cluster installed.

**Connecting cluster worker with cluster control-plane:**

* Access your control pane cluster and create the token to connect your worker cluster.

```
sudo kubeadm token create --print-join-command
```

> **A token will be generated see below for an example**
>
> kubeadm join 111.231.252.43:6443 --token 17htao.wo5w0fn1rpg21e9m --discovery-token-ca-cert-hash sha256:ea9a3611d926cf9a7cfadb089a0d47500f89bab1g5ef45310b9a8d82a65c48b

Now just copy the generated token into your cluster worker and the connection will be established. Once this is done, when consulting your node you will see the connection successfully.

<figure><img src="/files/slt1jlNDz1islPihroqP" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stakepool.dev.br/polygon/kubernetes/worker-cluster.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
