自建低耗服务器
来自ling
目录
服务器与网段规划
物理机:server60,70,80
master:61,71,81
barkup 250
data 850
home 350
vm 450
Centos远程桌面和ssh免登录
ssh-keygen ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.60.3
网络
保证每个机器的vi /etc/hostname和vi /etc/hosts 正确 vi /etc/sysconfig/network-scripts/ifcfg-ens32
主机
tee /etc/hostname <<-'EOF'
server60
EOF
虚拟机
tee /etc/hostname <<-'EOF'
server63
EOF
tee /etc/hosts <<-'EOF'
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.30.63 server63
192.168.30.64 server64
192.168.30.65 server65
192.168.30.73 server73
192.168.30.74 server74
192.168.30.75 server75
192.168.30.83 server83
192.168.30.84 server84
192.168.30.85 server85
EOF
tee /etc/sysconfig/network-scripts/ifcfg-ens32 <<-'EOF'
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens32"
UUID="d031d9ed-6bf9-40b5-bb5a-e1c81c4-6003"
DEVICE="ens32"
ONBOOT="yes"
IPADDR=192.168.30.63
NETMASK=255.255.255.0
GATEWAY=192.168.30.1
DNS1=192.168.30.1
EOF
service network restart
或
/etc/init.d/network restart
虚拟机规划
虚拟机初始化脚本
k8s安装
在物理机上执行
rm -rf /usr/bin/sealos
wget https://github.com/labring/sealos/releases/download/v4.1.3/sealos_4.1.3_linux_amd64.tar.gz \
&& tar zxvf sealos_4.1.3_linux_amd64.tar.gz sealos && chmod +x sealos && mv sealos /usr/bin
sealos gen labring/kubernetes:v1.25.0 labring/helm:v3.8.2 labring/calico:v3.24.1 \
--masters 192.168.30.60,192.168.30.73,192.168.30.83 \
--nodes 192.168.30.64,192.168.30.65,192.168.30.74,192.168.30.75 --passwd Wb19831010! > Clusterfile
sealos apply -f Clusterfile
sealos run labring/openebs:v1.9.0
sealos run labring/minio-operator:v4.4.16
sealos run labring/ingress-nginx:4.1.0
sealos run labring/mysql-operator:8.0.23-14.1
sealos run labring/redis-operator:3.1.4
sealos run labring/kubesphere:v3.3.1
sealos run docker.io/labring/kubernetes-dashboard:v1.0.8
kubectl port-forward -n kubernetes-dashboard --address 0.0.0.0 svc/kubernetes-dashboard 8001:443
主机docker安装
请使用sealos安装docker 否则会报错 labring/kubernetes-docker:v1.23.10 or uninstall docker retry http://t.zoukankan.com/longsanshi-p-11297570.html
https://www.sealos.io/zh-Hans/docs/getting-started/kuberentes-life-cycle
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
systemctl start docker
service docker start
systemctl enable docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"insecure-registries": ["192.168.30.60"],"graph":"/data/tools/docker","registry-mirrors": ["https://3ue1wki2.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
vim /usr/lib/systemd/system/docker.service
修改ExecStart行为下面内容
ExecStart=/usr/bin/dockerd --graph=/data/tools/docker --storage-driver=overlay --registry-mirror=https://3ue1wki2.mirror.aliyuncs.com -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
sudo tee /usr/lib/systemd/system/docker.service <<-'EOF'
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target docker.socket firewalld.service containerd.service
Wants=network-online.target
Requires=docker.socket containerd.service
[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 docker
#ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecStart=/usr/bin/dockerd --graph=/data/tools/docker --storage-driver=overlay --registry-mirror=https://3ue1wki2.mirror.aliyuncs.com -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
# Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
# Both the old, and new location are accepted by systemd 229 and up, so using the old location
# to make them work for either version of systemd.
StartLimitBurst=3
# Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
# Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
# this option work for either version of systemd.
StartLimitInterval=60s
# 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
# Comment TasksMax if your systemd version does not support it.
# Only systemd 226 and above support this option.
TasksMax=infinity
# 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
OOMScoreAdjust=-500
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload systemctl restart docker
测试
docker -H tcp://127.0.0.1:2375 ps
kubesphere
https://kubesphere.com.cn/docs/v3.3/
vmrun
vmrun list
列出正在运行的虚拟机
vmrun start "C:\VM\ubuntu.vmx" nogui
启动无图形界面虚拟机
vmrun stop "C:\VM\ubuntu.vmx" soft
正常关闭虚拟机
vmrun reset "C:\VM\ubuntu.vmx" hard
强制重启虚拟机
vmrun enableSharedFolders "C:\VM\ubuntu.vmx"
启用文件共享
宝塔
yum install -y wget && wget -O install.sh https://download.bt.cn/install/install_6.0.sh && sh install.sh ed8484bec
========================面板账户登录信息==========================
外网面板地址: https://123.146.150.102:13905/6f286ec8
内网面板地址: https://192.168.31.13:13905/6f286ec8
username: j5tdgrhc-->ling
password: 163d2e2d-->
=========================打开面板前请看===========================
【云服务器】请在安全组放行 13905 端口
因默认启用自签证书https加密访问,浏览器将提示不安全
点击【高级】-【继续访问】或【接受风险并继续】访问
教程:https://www.bt.cn/bbs/thread-117246-1-1.html
==================================================================