sudo apt update sudo apt upgrade -y sudo apt install sudo gpasswd -a user sudo
# # 以下は、bashrc と vim の設定で、もしよければ設定しておく。 # sudo apt install vim sudo apt install git cd git clone https://ehobby.jp/gitbucket/git/linux-scripts/bashrc.git mv bashrc/.bashrc . mv bashrc/.bashrc.d . mv bashrc/.vimrc . mv bashrc/.vimrc . # vim を一度起動し、「:PlugInstall」を実行する。
sudo apt remove docker sudo apt remove docker-engine sudo apt remove docker.io sudo apt remove containerd sudo apt remove runc
sudo apt update sudo apt install \ ca-certificates \ curl \ gnupg \ lsb-release
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update sudo install docker-ce docker-ce-cli contaainerd.io docker-compose-plugin
sudo gpasswd -a user docker
参照: https://kubernetes.io/ja/docs/setup/production-environment/container-runtimes/
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf overlay br_netfilter EOF
sudo modprobe overlay sudo modprobe br_netfilter
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
sudo sysctl --system
lsmod | grep br_netfilter lsmod | grep overlay
containerd config default | sudo tee /etc/containerd/config.toml
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc] ... [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] SystemdCgroup = true
sudo systemctl restart containerd
参照:https://kubernetes.io/ja/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-archive-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt update sudo apt install -y kubelet kubeadm kubectl sudo apt-mark hold kubelet kubeadm kubectl # apt-mark にて更新を抑止する。
swapoff -a
sudo kubeadm init --pod-network-cidr=<ホストと異なるネットワークを指定>例)
sudo kubeadm init --pod-network-cidr=192.168.0.0/16※最後に、ワーカーノードからの接続に必要なコマンドが表示されるのでメモする。
sudo kubeadm reset
mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config※ root ユーザーで実行する場合、下記を実行する。
export KUBECONFIG=/etc/kubernetes/admin.conf