ユーザ用ツール

サイト用ツール


サイドバー

このページの翻訳:



最近の更新



Tag Cloud

06_virtualization:05_container:12_kubernetes

文書の過去の版を表示しています。


12 Kubernetes

1.Kubernetesの要件としてSwapの停止

swapoff -a

2.Containerd用意

Kernel モジュール

cat <<EOF | tee /etc/modules-load.d/containerd.conf
overlay
br_netfilter
EOF

modprobe overlay
modprobe br_netfilter

Kernel パラメータ

cat <<EOF | tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables  = 1
net.ipv4.ip_forward                 = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF

sysctl ---system

パッケージインストール

apt update
apt install -y apt-transport-https ca-certificates curl software-properties-common

Docker GDG

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -

Docker repo

add-apt-repository \
    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) \
    stable"

install

apt update && apt install containerd.io
systemctl status containerd

Containerdの設定

mkdir -p /etc/containerd
containerd config default | tee /etc/containerd/config.toml
systemctl restart containerd

3. Kubernetsマスターノードセットアップ

kubeadm init

名前や、CIDRを指定する場合

kubeadm init --node-name master --pod-network-cidr=172.16.0.0/24

こんなのが表示されれば成功です。

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

Alternatively, if you are the root user, you can run:

  export KUBECONFIG=/etc/kubernetes/admin.conf

You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  https://kubernetes.io/docs/concepts/cluster-administration/addons/

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join 172.16.0.82:6443 --token qc0yz3.rs9q3122p8s2mko1 \
	--discovery-token-ca-cert-hash sha256:6687ea8b6dc4871f30edc0544b836e6ada87cf540bb4fb126b25b6f90177db88

kubectlを使えるように

export KUBECONFIG=/etc/kubernetes/admin.conf

# kubectl get node
NAME     STATUS     ROLES                  AGE   VERSION
master   NotReady   control-plane,master   83s   v1.23.5
06_virtualization/05_container/12_kubernetes.1650010765.txt.gz · 最終更新: 2022/04/15 17:19 by matsui