Skip to content

Commit 95268bf

Browse files
committed
doc: Update Documentation
1 parent 793a3a1 commit 95268bf

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

01-Vagrant-K3s-Cluster/K8s-and-K3s.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Pod Scheduling
2+
3+
By default, **Kubernetes does not schedule pods on master nodes** unless explicitly configured to do so. This behavior is enforced using the **`node-role.kubernetes.io/master`** or **`node-role.kubernetes.io/control-plane`** taints applied to the control plane nodes.
4+
5+
## Key Details:
6+
7+
- **Control Plane Nodes**: In a Kubernetes cluster, the control plane (master) nodes are reserved for managing the cluster's control plane components (e.g., `kube-apiserver`, `etcd`, `kube-controller-manager`, and `kube-scheduler`) to ensure stability and performance.
8+
- **Taints**: Kubernetes applies a taint to control plane nodes to prevent pods from being scheduled on them:
9+
10+
## Overriding This Behavior:
11+
12+
To allow pods to run on control plane nodes:
13+
14+
1. **Remove the Taint**: Remove the taint using the `kubectl taint` command:
15+
```bash
16+
kubectl taint nodes <node-name> node-role.kubernetes.io/master:NoSchedule-
17+
```
18+
19+
2. **Add a Toleration**: Modify the pod's deployment YAML to include a toleration, so it can tolerate the master node's taint:
20+
21+
```yaml
22+
spec:
23+
tolerations:
24+
- key: "node-role.kubernetes.io/master"
25+
operator: "Exists"
26+
effect: "NoSchedule"
27+
```
28+
29+
3. **Set `nodeSelector` or `affinity`**: To specifically schedule pods on the master node, use a `nodeSelector` or `nodeAffinity`:
30+
31+
```yaml
32+
spec:
33+
nodeSelector:
34+
node-role.kubernetes.io/master: ""
35+
```
36+
37+
## On Lightweight Clusters (e.g., K3s):
38+
39+
- In K3s, master nodes are also used as worker nodes by default because it is designed to work with minimal resources. Unless you configure dedicated worker nodes or taints manually, pods can run on the K3s master node.
40+
41+
> [!IMPORTANT]
42+
> On K3s by default, all servers are also agents.
43+
44+
### Replicate default K8s behavior
45+
46+
> [!WARNING]
47+
> System pods (like `kube-system` components) may need to run on the control plane node. You can add tolerations to their deployments.
48+
49+
```bash
50+
kubectl taint nodes <master-node-name> node-role.kubernetes.io/control-plane:NoSchedule
51+
```
52+
53+
54+
[Architecture K3s](https://docs.k3s.io/architecture)

01-Vagrant-K3s-Cluster/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## Create K3s Cluster with Vagrant and VirtualBox
22

3+
4+
Differences between K8s and K3s : 👉 [K8s-and-K3s.md](./K8s-and-K3s.md)
5+
36
### Prerequisites:
47

58
1. **Install Vagrant** – Follow the [Vagrant Install Guide](https://phoenixnap.com/kb/how-to-install-vagrant-on-ubuntu).

0 commit comments

Comments
 (0)