首页
随机
最近更改
特殊页面
社群首页
参数设置
关于WHY42
免责声明
WHY42
搜索
用户菜单
登录
欢迎来到Riguz的小站!这是一个私人wiki,用来记录一些我的笔记。
查看“︁Kubernetes installation”︁的源代码
←
Kubernetes installation
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
= Ubuntu 22.04 = ==System preparation== ===Updrage=== <syntaxhighlight lang="bash"> sudo apt update sudo apt upgrade do-release-update </syntaxhighlight> === Mount data disk === <syntaxhighlight lang="bash"> mkfs.xfs /dev/vdb lsof /var mv /var/ /var0 mkdir /mnt/newvar/ mount /dev/vdb /mnt/newvar/ rsync -aqxP /var0/* /mnt/newvar/ umount /mnt/newvar mkdir /var mount /dev/vdb /var vim /etc/fstab # /dev/vdb /var xfs defaults 0 0 </syntaxhighlight> === System configuration === <ref>https://kubernetes.io/docs/setup/production-environment/container-runtimes/#forwarding-ipv4-and-letting-iptables-see-bridged-traffic</ref> <syntaxhighlight lang="bash"> hostnamectl set-hostname master.xx.com cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf overlay br_netfilter EOF sudo modprobe overlay sudo modprobe br_netfilter # sysctl params required by setup, params persist across reboots cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-iptables = 1 net.bridge.bridge-nf-call-ip6tables = 1 net.ipv4.ip_forward = 1 EOF # Apply sysctl params without reboot sudo sysctl --system </syntaxhighlight> Verify: <syntaxhighlight lang="bash"> root@vm10-19-30-61:~# lsmod | grep br_netfilter br_netfilter 32768 0 bridge 307200 1 br_netfilter root@vm10-19-30-61:~# lsmod | grep overlay overlay 151552 0 root@vm10-19-30-61:~# sysctl net.bridge.bridge-nf-call-iptables net.bridge.bridge-nf-call-ip6tables net.ipv4.ip_forward net.bridge.bridge-nf-call-iptables = 1 net.bridge.bridge-nf-call-ip6tables = 1 net.ipv4.ip_forward = 1 </syntaxhighlight> === Disable swap === <syntaxhighlight lang="bash"> # check if swap is disabled swapon -s </syntaxhighlight> == Install Kubernetes == === Containerd runtime=== <ref>https://docs.docker.com/engine/install/ubuntu/</ref> <ref>https://mirrors.tuna.tsinghua.edu.cn/help/docker-ce/</ref> <syntaxhighlight lang="bash"> # Add Docker's official GPG key: sudo apt-get update sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc # Add the repository to Apt sources: echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null # Use mirror instead: echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu \ "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin sudo usermod -aG docker $USER sudo systemctl enable docker.service sudo systemctl enable containerd.service </syntaxhighlight> Generate containerd config using systemd: <syntaxhighlight lang="bash"> sudo containerd config default | sudo tee /etc/containerd/config.toml </syntaxhighlight> And modify it: <syntaxhighlight lang="bash"> [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc] ... [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] SystemdCgroup = true sandbox_image = "registry.aliyuncs.com/google_containers/pause:3.6" </syntaxhighlight> Restart the service: <syntaxhighlight lang="bash"> sudo systemctl restart containerd </syntaxhighlight> === Kubeadm=== [[Category:Linux/Unix]] [[Category:Kubernetes]]
返回
Kubernetes installation
。