2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

k8sのバージョンを指定してクラスター構築

Posted at

インストール

※インストール済みの場合は一度削除

sudo kubeadm reset
sudo apt purge kubelet kubeadm kubectl

バージョン一覧を取得

apt list -a kubeadm

apt-get installする際にバージョンを指定します。
今回は1.22.11を指定してみます。

doc - Install kubeadm

# 必要パッケージ
sudo apt-get update && sudo apt-get install -y apt-transport-https curl

# gpgキー
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -

# リポジトリ
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF

# バージョンを指定してインストール
sudo apt-get update
sudo apt-get install -y kubelet=1.22.11-00 kubeadm=1.22.11-00 kubectl=1.22.11-00
sudo apt-mark hold kubelet kubeadm kubectl

クラスター構築

kubeadm init \
    --control-plane-endpoint=<CONTROL_PLANE_IP> \
    --apiserver-advertise-address=<CONTROL_PLANE_IP> \
    --pod-network-cidr=<POD_CIDR> \
    --kubernetes-version=1.22.11

dockercontainerdが共存していてcontainerdを使いたい場合

kubeadm init \
    --control-plane-endpoint=<CONTROL_PLANE_IP> \
    --apiserver-advertise-address=<CONTROL_PLANE_IP> \
    --pod-network-cidr=<POD_CIDR> \
    --kubernetes-version=1.22.11 \
    --cri-socket=/run/containerd/containerd.sock

※ 参考

$ kubeadm init -h
...
      --cri-socket string                    Path to the CRI socket to connect. If empty kubeadm will try to auto-detect this value; use this option only if you have more than one CRI installed or if you have non-standard CRI socket.
...
      --kubernetes-version string            Choose a specific Kubernetes version for the control plane. (default "stable-1")
...
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?