Debian安装k8s

2023-12-31 05:29:17

在master和node上安装kube

apt-get update && apt-get install -y apt-transport-https
# 添加key
curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg > /etc/apt//etc/apt/trusted.gpg.d/aliyun-kubernetes.asc

# 添加软件源
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
EOF

# 执行更新并安装
apt-get update
apt-get install -y kubelet kubeadm kubectl

安装master

cat <<EOF >/etc/default/kubelet
KUBELET_EXTRA_ARGS="--pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.6"
EOF

# 关闭swap
sudo swapoff -a

# 初始化
sudo kubeadm init --kubernetes-version v1.27.4 --image-repository registry.aliyuncs.com/google_containers --apiserver-advertise-address 0.0.0.0 --service-cidr 10.1.0.0/16 --pod-network-cidr 10.2.0.0/16

这时,master应该就安装完成了

安装node

sudo kubeadm join 192.168.8.5:6443 --token XXXXXX.XXXXXXXXXXXXXXXX --discovery-token-ca-cert-hash sha256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

其中token和hash来自master初始化最后的输出,地址和端口是master的apiserver

文章来源:https://blog.csdn.net/lcwyan/article/details/135311720
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。