mirror of
https://github.com/kelseyhightower/kubernetes-the-hard-way.git
synced 2025-12-15 01:08:58 +03:00
Update to Kubernetes 1.32.3
This commit is contained in:
@@ -1,20 +1,22 @@
|
||||
# Bootstrapping the Kubernetes Worker Nodes
|
||||
|
||||
In this lab you will bootstrap two Kubernetes worker nodes. The following components will be installed: [runc](https://github.com/opencontainers/runc), [container networking plugins](https://github.com/containernetworking/cni), [containerd](https://github.com/containerd/containerd), [kubelet](https://kubernetes.io/docs/admin/kubelet), and [kube-proxy](https://kubernetes.io/docs/concepts/cluster-administration/proxies).
|
||||
In this lab you will bootstrap two Kubernetes worker nodes. The following components will be installed: [runc](https://github.com/opencontainers/runc), [container networking plugins](https://github.com/containernetworking/cni), [containerd](https://github.com/containerd/containerd), [kubelet](https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet), and [kube-proxy](https://kubernetes.io/docs/concepts/cluster-administration/proxies).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Copy Kubernetes binaries and systemd unit files to each worker instance:
|
||||
The commands in this section must be run from the `jumpbox`.
|
||||
|
||||
Copy the Kubernetes binaries and systemd unit files to each worker instance:
|
||||
|
||||
```bash
|
||||
for host in node-0 node-1; do
|
||||
SUBNET=$(grep $host machines.txt | cut -d " " -f 4)
|
||||
sed "s|SUBNET|$SUBNET|g" \
|
||||
configs/10-bridge.conf > 10-bridge.conf
|
||||
|
||||
configs/10-bridge.conf > 10-bridge.conf
|
||||
|
||||
sed "s|SUBNET|$SUBNET|g" \
|
||||
configs/kubelet-config.yaml > kubelet-config.yaml
|
||||
|
||||
|
||||
scp 10-bridge.conf kubelet-config.yaml \
|
||||
root@$host:~/
|
||||
done
|
||||
@@ -24,15 +26,14 @@ done
|
||||
for host in node-0 node-1; do
|
||||
scp \
|
||||
downloads/runc.arm64 \
|
||||
downloads/crictl-v1.31.1-linux-arm64.tar.gz \
|
||||
downloads/cni-plugins-linux-arm64-v1.6.0.tgz \
|
||||
downloads/containerd-2.0.0-linux-arm64.tar.gz \
|
||||
downloads/crictl-v1.32.0-linux-arm64.tar.gz \
|
||||
downloads/cni-plugins-linux-arm64-v1.6.2.tgz \
|
||||
downloads/containerd-2.1.0-beta.0-linux-arm64.tar.gz \
|
||||
downloads/kubectl \
|
||||
downloads/kubelet \
|
||||
downloads/kube-proxy \
|
||||
configs/99-loopback.conf \
|
||||
configs/containerd-config.toml \
|
||||
configs/kubelet-config.yaml \
|
||||
configs/kube-proxy-config.yaml \
|
||||
units/containerd.service \
|
||||
units/kubelet.service \
|
||||
@@ -41,7 +42,7 @@ for host in node-0 node-1; do
|
||||
done
|
||||
```
|
||||
|
||||
The commands in this lab must be run on each worker instance: `node-0`, `node-1`. Login to the worker instance using the `ssh` command. Example:
|
||||
The commands in the next section must be run on each worker instance: `node-0`, `node-1`. Login to the worker instance using the `ssh` command. Example:
|
||||
|
||||
```bash
|
||||
ssh root@node-0
|
||||
@@ -54,23 +55,23 @@ Install the OS dependencies:
|
||||
```bash
|
||||
{
|
||||
apt-get update
|
||||
apt-get -y install socat conntrack ipset
|
||||
apt-get -y install socat conntrack ipset kmod
|
||||
}
|
||||
```
|
||||
|
||||
> The socat binary enables support for the `kubectl port-forward` command.
|
||||
|
||||
### Disable Swap
|
||||
Disable Swap
|
||||
|
||||
By default, the kubelet will fail to start if [swap](https://help.ubuntu.com/community/SwapFaq) is enabled. It is [recommended](https://github.com/kubernetes/kubernetes/issues/7294) that swap be disabled to ensure Kubernetes can provide proper resource allocation and quality of service.
|
||||
Kubernetes has limited support for the use of swap memory, as it is difficult to provide guarantees and account for pod memory utilization when swap is involved.
|
||||
|
||||
Verify if swap is enabled:
|
||||
Verify if swap is disabled:
|
||||
|
||||
```bash
|
||||
swapon --show
|
||||
```
|
||||
|
||||
If output is empty then swap is not enabled. If swap is enabled run the following command to disable swap immediately:
|
||||
If output is empty then swap is disabled. If swap is enabled run the following command to disable swap immediately:
|
||||
|
||||
```bash
|
||||
swapoff -a
|
||||
@@ -95,11 +96,11 @@ Install the worker binaries:
|
||||
```bash
|
||||
{
|
||||
mkdir -p containerd
|
||||
tar -xvf crictl-v1.31.1-linux-arm64.tar.gz
|
||||
tar -xvf containerd-2.0.0-linux-arm64.tar.gz -C containerd
|
||||
tar -xvf cni-plugins-linux-arm64-v1.6.0.tgz -C /opt/cni/bin/
|
||||
tar -xvf crictl-v1.32.0-linux-arm64.tar.gz
|
||||
tar -xvf containerd-2.1.0-beta.0-linux-arm64.tar.gz -C containerd
|
||||
tar -xvf cni-plugins-linux-arm64-v1.6.2.tgz -C /opt/cni/bin/
|
||||
mv runc.arm64 runc
|
||||
chmod +x crictl kubectl kube-proxy kubelet runc
|
||||
chmod +x crictl kubectl kube-proxy kubelet runc
|
||||
mv crictl kubectl kube-proxy kubelet runc /usr/local/bin/
|
||||
mv containerd/bin/* /bin/
|
||||
}
|
||||
@@ -155,9 +156,11 @@ Create the `kubelet-config.yaml` configuration file:
|
||||
}
|
||||
```
|
||||
|
||||
Be sure to complete the steps in this section on each worker node, `node-0` and `node-1`, before moving on to the next section.
|
||||
|
||||
## Verification
|
||||
|
||||
The compute instances created in this tutorial will not have permission to complete this section. Run the following commands from the `jumpbox` machine.
|
||||
Run the following commands from the `jumpbox` machine.
|
||||
|
||||
List the registered Kubernetes nodes:
|
||||
|
||||
@@ -169,8 +172,8 @@ ssh root@server \
|
||||
|
||||
```
|
||||
NAME STATUS ROLES AGE VERSION
|
||||
node-0 Ready <none> 1m v1.31.2
|
||||
node-1 Ready <none> 10s v1.31.2
|
||||
node-0 Ready <none> 1m v1.32.3
|
||||
node-1 Ready <none> 10s v1.32.3
|
||||
```
|
||||
|
||||
Next: [Configuring kubectl for Remote Access](10-configuring-kubectl.md)
|
||||
|
||||
Reference in New Issue
Block a user