1,https://www.sealyun.com/instructions
2, 4台KVM虚机
192.168.122.210 nodel
192.168.122.22 node2
192.168.122.83 node3
192.168.122.128 node4
3, 之前的准备
virt-install —name=nodel —memory=1024,maxmemory=2048 —vcpus=1,maxvcpus=2 —os-type=linux —os-variant=centos7.0 —location=/root/CentOS-7-x86_64-Minimal-2009.iso
—disk path=/tmp/Centos7-Minimal-2-2004.32 —network default,model=virtio —graphics=vnc —console=pty,target_type=serial —extra-args=”console=tty0 console=ttyS0”
用 安装的磁盘文件 创建虚机
virt-install —name=node2 —memory=1024,maxmemory=2048 —vcpus=1,maxvcpus=2 —os-type=linux —os-variant=centos7.0 —disk path=/tmp/Centos7-Minimal-2-2004.32.1 —network default,model=virtio —graphics=vnc —console=pty,target_type=serial —boot hd
virt-install —name=node3 —memory=1024,maxmemory=2048 —vcpus=1,maxvcpus=2 —os-type=linux —os-variant=centos7.0 —disk path=/tmp/Centos7-Minimal-2-2004.32.2 —network default,model=virtio —graphics=vnc —console=pty,target_type=serial —boot hd
virt-install —name=node4 —memory=1024,maxmemory=2048 —vcpus=1,maxvcpus=2 —os-type=linux —os-variant=centos7.0 —disk path=/tmp/Centos7-Minimal-2-2004.32.3 —network default,model=virtio —graphics=vnc —console=pty,target_type=serial —boot hd
用 这个命令安装1个 dhcp 的虚机
(由于我的疏忽,node1 写成nodel)
可以用virsh console 7进入界面安装
wget http://mirrors.neusoft.edu.cn/centos/7.9.2009/isos/x86_64/CentOS-7-x86_64-Minimal-2009.iso
qemu-img create -f qcow2 /tmp/Centos7-Minimal-2-2004.32 32G
修改虚机内存大小
virsh setmaxmem nodel 4194304 要虚机关闭
virsh start nodel
virsh setmem nodel 4194304 要虚机开启
4194304 =4G
wget -c https://sealyun.oss-cn-beijing.aliyuncs.com/latest/sealos && \
chmod +x sealos && mv sealos /usr/bin
sealos init —passwd baixin@v5 \
—master 192.168.122.210 —master 192.168.122.22 —master 192.168.122.83 \
—node 192.168.122.128 \
—pkg-url /root/kube1.18.0.tar.gz \
—version v1.18.0
最后完成
/\ \ /\ \ /\ \ /_\ /\ \ /\ \
/::\ \ /::\ \ /::\ \ /:/ / /::\ \ /::\ \
/:/\ \ \ /:/\:\ \ /:/\:\ \ /:/ / /:/\:\ \ /:/\ \ \
\:~\ \ \ /::~\:\ \ /::~\:\ \ /:/ / /:/ \:\ \ \:~\ \ \
/\ \:\ \ _\ /:/\:\ \:_\ /:/\:\ \:_\ /:// /:// \:_\ /\ \:\ \ _\
\:\ \:\ \// \:~\:\ \// \/\:\/:/ / \:\ \ \:\ \ /:/ / \:\ \:\ \//
\:\ \:_\ \:\ \:_\ \::/ / \:\ \ \:\ /:/ / \:\ \:_\
\:\/:/ / \:\ \// /:/ / \:\ \ \:\/:/ / \:\/:/ /
\::/ / \:\\ /:/ / \:_\ \::/ / \::/ /
\/__/ \// \// \// \// \//
官方文档:sealyun.com
项目地址:github.com/fanux/sealos
QQ群 :98488045
常见问题:sealyun.com/faq
[root@node1 ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
node1 Ready master 4m48s v1.18.0
node2 Ready master 4m15s v1.18.0
node3 Ready master 4m14s v1.18.0
node4 Ready
wget https://github.com/projectcalico/calicoctl/releases/download/v3.17.0/calicoctl-linux-amd64
[root@node1 ~]# chmod +x ./calicoctl-linux-amd64
[root@node1 ~]# install calicoctl-linux-amd64 /usr/bin/calicoctl
[root@node1 ~]# calictl node status
-bash: calictl: command not found
[root@node1 ~]# calicoctl node status
Calico process is not running.
[root@node1 ~]# mkdir /etc/calico
[root@node1 ~]# vi /etc/calico/calicoctl.cfg
[root@node1 ~]# ECTD_ENDPOINTS=https://node1:2379 calicoctl node status
Calico process is not running.
[root@node1 ~]# export CALICO_DATASTORE_TYPE=kubernetes
[root@node1 ~]# export CALICO_KUBECONFIG=~/.kube/config
[root@node1 ~]# calicoctl get workloadendpoints
WORKLOAD NODE NETWORKS INTERFACE
nginx-f89759699-2zxxq node4 100.127.10.71/32 cali4d92a499c78
nginx-f89759699-6bqzh node4 100.127.10.72/32 cali9e8f9b89543
nginx-f89759699-7z2t2 node4 100.127.10.69/32 cali7c6ac0b1a01
nginx-f89759699-9gw7t node1 100.66.209.196/32 cali9a673ead28d
nginx-f89759699-b928w node1 100.66.209.197/32 cali6bb50727eb6
nginx-f89759699-bshmw node4 100.127.10.66/32 calie067f71a8eb
nginx-f89759699-bsmdl node3 100.74.135.1/32 calie40a1fbc812
nginx-f89759699-fsvzr node2 100.108.11.193/32 calif2c10ab0336
nginx-f89759699-lqtmr node4 100.127.10.70/32 cali3d6176642f1
nginx-f89759699-m4tpt node4 100.127.10.68/32 cali51ecbce8ed1
nginx-f89759699-nxfzz node1 100.66.209.195/32 califa13f1809e7
nginx-f89759699-vlfql node4 100.127.10.65/32 cali14a6cb188eb
nginx-f89759699-z28jf node4 100.127.10.67/32 calid624ce3a967
[root@node1 ~]# DATASTORE_TYPE=kubernetes KUBECONFIG=~/.kube/config calicoctl get nodes
NAME
node1
node2
node3
node4
[root@node1 ~]# DATASTORE_TYPE=kubernetes KUBECONFIG=~/.kube/config calicoctl get bgppeer
NAME PEERIP NODE ASN
[root@node1 ~]# DATASTORE_TYPE=kubernetes KUBECONFIG=~/.kube/config calicoctl get ipPool -o yaml
apiVersion: projectcalico.org/v3
items:
- apiVersion: projectcalico.org/v3
kind: IPPool
metadata:
creationTimestamp: “2020-12-08T16:45:31Z”
name: default-ipv4-ippool
resourceVersion: “513”
uid: 55da9135-48fd-4543-a082-7cf799ebe96f
spec:
blockSize: 26
cidr: 100.64.0.0/10
ipipMode: Always
natOutgoing: true
nodeSelector: all()
vxlanMode: Never
kind: IPPoolList
metadata:
resourceVersion: “6861”
[root@node1 ~]# kubectl exec -it calico-node-4hssf -n kube-system —sh
Error: unknown flag: —sh
See ‘kubectl exec —help’ for usage.
[root@node1 ~]# kubectl exec -it calico-node-4hssf -n kube-system —bash
Error: unknown flag: —bash
See ‘kubectl exec —help’ for usage.
[root@node1 ~]# kubectl exec -it calico-node-4hssf -n kube-system sh
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl kubectl exec [POD] — [COMMAND] instead.
# ps
PID TTY TIME CMD
3209 pts/0 00:00:00 sh
3218 pts/0 00:00:00 ps
# ps aux | grep calico
root 64 1.1 0.7 143268 30524 ? Sl 16:46 0:27 calico-node -felix
root 65 0.0 0.6 143268 24328 ? Sl 16:46 0:00 calico-node -confd
root 135 0.0 0.0 760 260 ? S 16:46 0:00 bird6 -R -s /var/run/calico/bird6.ctl -d -c /etc/calico/confd/config/bird6.cfg
root 136 0.0 0.0 820 524 ? S 16:46 0:00 bird -R -s /var/run/calico/bird.ctl -d -c /etc/calico/confd/config/bird.cfg
root 3238 0.0 0.0 3072 716 pts/0 S+ 17:24 0:00 grep calico
# ps aux | grep bird
root 60 0.0 0.0 2148 372 ? Ss 16:46 0:00 runsv bird
root 61 0.0 0.0 2148 376 ? Ss 16:46 0:00 runsv bird6
root 135 0.0 0.0 760 260 ? S 16:46 0:00 bird6 -R -s /var/run/calico/bird6.ctl -d -c /etc/calico/confd/config/bird6.cfg
root 136 0.0 0.0 820 524 ? S 16:46 0:00 bird -R -s /var/run/calico/bird.ctl -d -c /etc/calico/confd/config/bird.cfg
root 3252 0.0 0.0 3072 716 pts/0 S+ 17:24 0:00 grep bird
#
备注: 今天使用中遇到vm hang 住的问题,经检查 宿主机磁盘不够了,vm paused