ZBLOG

单机安装k8s

To install Kubernetes on a single machine, you can follow the steps below:

  1. Install Docker:
sudo apt-get update
sudo apt-get install docker.io
  1. Install kubeadm, kubelet and kubectl:
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
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 kubeadm kubectl
  1. Initialize the cluster:
sudo swapoff -a   # if swap is enabled, disable it to prevent issues with kubelet.
sudo kubeadm init --pod-network-cidr=10.244.0.0/16  # replace pod network CIDR as per your requirement.
  1. Set up kubectl configuration:
mkdir -p $HOME/.kube 
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config  
sudo chown $(id -u):$(id -g) $HOME/.kube/config  
  1. Deploy a pod network to the cluster:

You can choose from different pod network providers like Flannel, Calico, etc.

For example, to deploy Flannel:

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml 
  1. Check if all nodes are ready:
kubectl get nodes 

You should see one node in Ready state.

That’s it! Your Kubernetes cluster is now set up on a single machine!

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=4736

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?