# control pane 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
sudo apt-get install kubectl=1.28.0-00

```

**Step 5: Initialize Kubernetes Control Plane**

* Pull the required container images:

```
sudo kubeadm config images pull --kubernetes-version=1.28.0

```

Initialize the Kubernetes control plane (replace `1.28.0` with your desired version):

```
sudo kubeadm init --kubernetes-version=1.28.0

```

Follow these steps carefully to set up your Kubernetes control plane successfully. Make sure to adjust the versions and configurations as needed for your specific requirements. At the end of the steps, your instance must be configured.

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

To start the cluster you need the following steps:

> Run the mentioned commands with `root` user

```
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf SHOME/.kube/config
sudo chown $(id -u):$ (id -g) $HOME/.kube/config
```

Now we need to install the network plugin in Kubernetes.

Can be installed onto your CNI-enabled Kubernetes cluster with a single command:

```
sudo kubectl apply -f https://github.com/weaveworks/weave/releases/download/v2.8.1/weave-daemonset-k8s.yaml
```

After completing this process, you now have your control plane cluster installed and configured.

To test whether it is working as expected, you can check the node status.

```
sudo kubectl get nodes -o wide
```

<figure><img src="/files/nuVNU4QCZWYPyYqMxNxZ" 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/control-pane-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.
