IT评测·应用市场-qidao123.com
标题:
虚拟机使用minikube搭建k8s集群
[打印本页]
作者:
石小疯
时间:
2024-9-5 19:19
标题:
虚拟机使用minikube搭建k8s集群
一、安装docker(目前登录的是root用户)
1、下载
https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
本次使用 20.10.9版本
2、解压
tar xfz docker-20.10.9.tgz
复制代码
3、复制到 /usr/bin
cp -rf docker/* /usr/bin/
复制代码
4、将docker注册为系统服务
vi /usr/lib/systemd/system/docker.service
复制代码
写入内容
点击查看内容
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by do cker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=onfailure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
复制代码
保存
5、添加文件权限
chmod u+x /usr/lib/systemd/system/docker.service
复制代码
6、重载unit配置文件
systemctl daemon-reload
复制代码
7、启动docker
systemctl enable docker
复制代码
8、查看docker状态
systemctl status docker
复制代码
二、安装kubectl v1.30.0
1、新建用户
useradd kube
复制代码
2、给予权限
vi /etc/sudoers
复制代码
在这两行下面
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
复制代码
添加内容
kube ALL=(ALL) NOPASSWD:ALL
复制代码
保存,这里必要强制保存 wq!
3、切换用户
su kube
复制代码
接下来所有操纵都是kube用户
4、新建组docker,kube用户加入docker组
sudo groupadd docker
sudo usermod -aG docker $USER && newgrp docker
复制代码
5、下载
curl -LO https://dl.k8s.io/release/v1.30.0/bin/linux/amd64/kubectl
复制代码
6、安装 kubectl
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
复制代码
7、测试是否安装成功
kubectl version --client
复制代码
三、安装minikube
1、下载(如果不能下载去阿里云下载)
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
复制代码
2、安装
sudo install minikube-linux-amd64 /usr/local/bin/minikube && rm minikube-linux-amd64
复制代码
3、测试是否安装成功
minikube version
复制代码
4、启动
minikube start
复制代码
启动过程大抵如下,会自动拉取镜像
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
欢迎光临 IT评测·应用市场-qidao123.com (https://dis.qidao123.com/)
Powered by Discuz! X3.4