13使用KuboardSpray部署k8s集群

0 阅读1分钟

使用KuboardSpray部署k8s集群

Kuboard网站 kuboard.cn/ 上面有k8s的学习资料和部署教程,这里部署步骤完全按照官网一步一步执行的

使用CentOS7u9操作系统,然后准备如下配置的三个节点

ipCPU内存硬盘角色主机名
192.168.91.2201C1G40GBkuboardspraykuboardspray
192.168.91.2212C2G40GBmastermaster01
192.168.91.2222C2G40GBworker(node)worker01
# 所有节点,配置hosts
cat >> /etc/hosts << EOF
192.168.91.220  kuboardspray
192.168.91.221  master01
192.168.91.222  worker01
EOF

# kuboardspray
# 安装docker
wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum -y install --setopt=obsoletes=0 docker-ce-24.0.6-1.el7
cat << EOF > /etc/docker/daemon.json
{
  "registry-mirrors": ["https://zwyx2n3v.mirror.aliyuncs.com"]
}
EOF
systemctl enable --now docker

docker run -d \
  --privileged \
  --restart=unless-stopped \
  --name=kuboard-spray \
  -p 80:80/tcp \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v ~/kuboard-spray-data:/data \
  eipwork/kuboard-spray:v1.2.4-amd64

在浏览器打开地址 http://192.168.91.220,输入用户名 admin,默认密码 Kuboard123,即可登录 Kuboard-Spray 界面

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

# master01
kubectl get nodes
NAME       STATUS   ROLES           AGE     VERSION
master01   Ready    control-plane   6m40s   v1.26.4
worker01   Ready    <none>          5m49s   v1.26.4

# 部署一个nginx进行验证
kubectl run nginx1 --image=nginx:1.15-alpine

kubectl get pods -o wide | grep nginx
nginx1                               1/1     Running   0             92s   10.234.40.4      worker01   <none>           <none>

curl 10.234.40.4
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
...

# 删除pod
kubectl delete pod nginx1