k8s:distributions:rke2
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| k8s:distributions:rke2 [2023/02/20 22:43] – created admin | k8s:distributions:rke2 [2023/11/11 18:21] (current) – admin | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| ## Install RKE2 | ## Install RKE2 | ||
| + | |||
| + | There are two install types `agent` for pure worker nodes and `server` for management nodes. | ||
| + | There need to be at least three `server` nodes. there can be any number of `agent` nodes. | ||
| It is probably best to install the same version of Kubernetes as the cluster the node will be attached to. If needed the whole cluster can be upgraded after adding the nodes. | It is probably best to install the same version of Kubernetes as the cluster the node will be attached to. If needed the whole cluster can be upgraded after adding the nodes. | ||
| Line 13: | Line 16: | ||
| Create a `/ | Create a `/ | ||
| ```yaml | ```yaml | ||
| - | node-name: | + | node-name: |
| node-external-ip: | node-external-ip: | ||
| - 10.3.6.55 | - 10.3.6.55 | ||
| Line 25: | Line 28: | ||
| # on all other servers after the initial setup on 10.6.16.61 is completed | # on all other servers after the initial setup on 10.6.16.61 is completed | ||
| server: https:// | server: https:// | ||
| - | [...] | + | cluster-cidr: |
| + | service-cidr: | ||
| + | cni: calico | ||
| + | disable-kube-proxy: | ||
| + | etcd-expose-metrics: | ||
| + | etcd-snapshot-retention: | ||
| + | etcd-snapshot-schedule-cron: | ||
| + | kube-controller-manager-arg: | ||
| + | - cert-dir=/ | ||
| + | - secure-port=10257 | ||
| + | kube-controller-manager-extra-mount: | ||
| + | - >- | ||
| + | / | ||
| + | kube-scheduler-arg: | ||
| + | - cert-dir=/ | ||
| + | - secure-port=10259 | ||
| + | kube-scheduler-extra-mount: | ||
| + | - >- | ||
| + | / | ||
| + | kubelet-arg: | ||
| + | - max-pods=250 | ||
| + | kubelet-extra-mount: | ||
| + | - >- | ||
| + | / | ||
| + | node-label: | ||
| + | - cattle.io/ | ||
| + | protect-kernel-defaults: | ||
| ``` | ``` | ||
| - | See Setting Up RKE2 below. | + | Create a `/ |
| + | ```yaml | ||
| + | mirrors: | ||
| + | docker.io: | ||
| + | endpoint: | ||
| + | - " | ||
| + | ``` | ||
| + | |||
| + | ### Server | ||
| + | |||
| + | ```bash | ||
| + | export PATH=$PATH:/ | ||
| + | sudo systemctl enable rke2-server.service | ||
| + | sudo systemctl start rke2-server.service | ||
| + | sudo journalctl -u rke2-server -f | ||
| + | ``` | ||
| + | |||
| + | ### Agent | ||
| ```bash | ```bash | ||
| Line 34: | Line 80: | ||
| sudo systemctl start rke2-agent.service | sudo systemctl start rke2-agent.service | ||
| sudo journalctl -u rke2-agent -f | sudo journalctl -u rke2-agent -f | ||
| + | ``` | ||
| + | ## (Re)creating local storage provisioner volumes | ||
| + | |||
| + | As any service using local storage should implement restroing missing data themselves this describes how to create just the empty volumes/ | ||
| + | |||
| + | As the local storage provisioner can not change the size of the volumes it will select the next larger volume for any claim. For example a 20 GB claim will select a 29.4 GiB volume, a 30 GB claim a 30.2 GiB volume etc. | ||
| + | |||
| + | For flatcar-linux we can follow the advice on the sig-storage-local-static-provisioner website: Mount formatted block storage on `/ | ||
| + | |||
| + | * Create a block device for an acdh-clusterX node in vCenter. Note that the size of the block device should be a little larger than the desired even number if GiB (example: for a 20 GiB volume create a 21 GiB disk) as there is a difference in how disk size is calculated | ||
| + | * Format the volume on the respective flatcar node. Use ext4 or xfs depending on the needs of the service (for example elasticsearch/ | ||
| + | ```bash | ||
| + | sudo mkfs.ext4 /dev/sdd | ||
| + | ``` | ||
| + | * reserved blocks for root are not very useful in kubernetes so set them to 0 | ||
| + | ```bash | ||
| + | sudo tune2fs -r 0 / | ||
| + | ``` | ||
| + | * Get the UUID. It is part of the output of `mkfs.ext4` above. It is also for example available using using `ls -l / | ||
| + | * Create a mount unit to mount the filesystem. The filename needs to match the mount point and is encoded. | ||
| + | This will automatically create a `< | ||
| + | ```bash | ||
| + | sudo cp / | ||
| + | sudo vi / | ||
| + | # change directory name and device name | ||
| + | # [Unit] | ||
| + | # Description=Mount local storage at / | ||
| + | # Before=local-fs.target | ||
| + | # [Mount] | ||
| + | # What=/ | ||
| + | # Where=/ | ||
| + | # Type=ext4 or xfs | ||
| + | # [Install] | ||
| + | # WantedBy=local-fs.target | ||
| + | sudo systemctl daemon-reload | ||
| + | sudo systemctl enable " | ||
| + | ``` | ||
| + | |||
| + | ## Updating RKE2 | ||
| + | |||
| + | This is best done using the Rancher UI for cluster updates. If the version there and the version on the nodes get out of sync _also all other settings cannot be changed anymore!_. | ||
| + | But for reference here is the very simple method of following the stable release channel for RKE2: | ||
| + | |||
| + | ```bash | ||
| + | curl -sfL https:// | ||
| + | sudo systemctl restart rke2-agent | ||
| + | # or | ||
| + | sudo systemctl restart rke2-server | ||
| + | ``` | ||
| + | |||
| + | Repeat on each node after the last one is showing as up and active in Rancher. | ||
| + | Start with the management/ | ||
| + | |||
| + | [Here](https:// | ||
| + | Kubernetes major versions are also channels. The channel latest refers to the very latest releases of K8s available. | ||
| + | |||
| + | ## Troubleshooting | ||
| + | |||
| + | ### Using command line tools to manually delete container images images | ||
| + | |||
| + | ```bash | ||
| + | sudo -s | ||
| + | # as root | ||
| + | export PATH=$PATH:/ | ||
| + | export CONTAINERD_ADDRESS=/ | ||
| + | ctr -n k8s.io i rm $(ctr -n k8s.io i ls -q | grep <image name to delete, regex>) | ||
| + | # or | ||
| + | export CONTAINER_RUNTIME_ENDPOINT=unix:/// | ||
| + | crictl images | ||
| + | crictl rmi <image name to delete> | ||
| ``` | ``` | ||
k8s/distributions/rke2.1676929436.txt.gz · Last modified: by admin