华为云智能社区ku

举报
yd_220122813 发表于 2024/11/08 10:31:30 2024/11/08
【摘要】 #!/bin/bashrm -rf /etc/yum.repos.d/*cat << EOF > /etc/yum.repos.d/centos.repo[os]name=Qcloud centos os - \$basearchbaseurl=http://mirrors.cloud.tencent.com/centos/\$releasever/os/\$basearch/enabled...
#!/bin/bash
rm -rf /etc/yum.repos.d/*
cat << EOF > /etc/yum.repos.d/centos.repo
[os]
name=Qcloud centos os - \$basearch
baseurl=http://mirrors.cloud.tencent.com/centos/\$releasever/os/\$basearch/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-7

[updates]
name=Qcloud centos updates - \$basearch
baseurl=http://mirrors.cloud.tencent.com/centos/\$releasever/updates/\$basearch/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-7

[extras]
name=Qcloud centos extras - \$basearch
baseurl=http://mirrors.cloud.tencent.com/centos/\$releasever/extras/\$basearch/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-7

[epel]
name=EPEL for redhat/centos \$releasever - \$basearch
baseurl=http://mirrors.cloud.tencent.com/epel/\$releasever/\$basearch/
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/epel/RPM-GPG-KEY-EPEL-7
EOF
tar -zxvf Python-3.7.3.tgz
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel libffi-devel gcc make -y
cd Python-3.7.3
./configure
make && make install
pip3 install -i https://mirrors.cloud.tencent.com/pypi/simple --upgrade pip
pip3 config set global.index-url https://mirrors.cloud.tencent.com/pypi/simple
#!/bin/bash
master_ip=""
wget 
echo -e " master\n edge-node1\n edge-node2" >> /etc/hosts

tar -zxvf kubernetes_kubeedge.tar.gz -C /opt/

kubectl patch daemonset kube-proxy -n kube-system -p '{"spec": {"template": {"spec": {"affinity": {"nodeAffinity": {"requiredDuringSchedulingIgnoredDuringExecution": {"nodeSelectorTerms": [{"matchExpressions": [{"key": "node-role.kubernetes.io/edge", "operator": "DoesNotExist"}]}]}}}}}}}'
kubectl patch daemonset kube-flannel-ds -n kube-system -p '{"spec": {"template": {"spec": {"affinity": {"nodeAffinity": {"requiredDuringSchedulingIgnoredDuringExecution": {"nodeSelectorTerms": [{"matchExpressions": [{"key": "node-role.kubernetes.io/edge", "operator": "DoesNotExist"}]}]}}}}}}}'

mv /opt/kubeedge/keadm /usr/bin/keadm

cd /opt/k8simage/
bash load.sh

cd /opt/kubeedge
docker load  -i cloudcore.tar
docker load -i installation.tar
docker load -i mosquitto.tar
docker load -i pause.tar

tar -zxvf /opt/kubeedge/kubeedge-1.11.1.tar.gz
# tar -xzvf /opt/kubeedge/kubeedge-v1.11.1-linux-amd64.tar.gz
mkdir /etc/kubeedge/
cp -rvf /opt/kubeedge/kubeedge-v1.11.1-linux-amd64.tar.gz  /etc/kubeedge/
cp -rvf /opt/kubeedge/kubeedge-1.11.1/build/crds/   /etc/kubeedge/
cp -rvf /opt/kubeedge/kubeedge-1.11.1/vendor/k8s.io/kubernetes/pkg/kubelet/checkpointmanager/checksum /etc/kubeedge/
cp /opt/kubeedge/kubeedge-1.11.1/build/tools/* /etc/kubeedge/

cd /etc/kubeedge/
pwd
sleep 5
keadm deprecated init --advertise-address=$master_ip --kubeedge-version=1.11.1
# ss -ntpl
netstat  -ntpl |grep cloudcore
sleep 5

sed -i '/cloudStream:/ {N; s/enable: false/enable: true/}' /etc/kubeedge/config/cloudcore.yaml
sed -i '/router:/,+2 s/enable: false/enable: true/' /etc/kubeedge/config/cloudcore.yaml
kill -9 $(ps aux | grep cloudcore | awk 'NR==1{print $2}')
cp /etc/kubeedge/cloudcore.service /etc/systemd/system/cloudcore.service
chmod +x /etc/systemd/system/cloudcore.service
systemctl daemon-reload
systemctl start cloudcore
systemctl enable cloudcore.service
sleep 3

export CLOUDCOREIPS=$master_ip
cd /etc/kubeedge/
./certgen.sh stream

iptables -F && iptables -t nat -F && iptables -t mangle -F && iptables -X

sleep 5
keadm gettoken
#!/bin/bash

token=""
master_ip=""

echo -e " master\n edge-node1\n edge-node2" >> /etc/hosts

tar -zxvf kubernetes_kubeedge.tar.gz -C /opt/

rm -rf /etc/yum.repos.d/*
cat >> /etc/yum.repos.d/local.repo << EOF
[local]
name=local
baseurl=file:///opt/yum
enabled=1
gpgcheck=0
EOF

cat << EOF > /etc/yum.repos.d/centos.repo
[os]
name=Qcloud centos os - \$basearch
baseurl=http://mirrors.cloud.tencent.com/centos/\$releasever/os/\$basearch/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-7

[updates]
name=Qcloud centos updates - \$basearch
baseurl=http://mirrors.cloud.tencent.com/centos/\$releasever/updates/\$basearch/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-7

[extras]
name=Qcloud centos extras - \$basearch
baseurl=http://mirrors.cloud.tencent.com/centos/\$releasever/extras/\$basearch/
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-7

[epel]
name=EPEL for redhat/centos \$releasever - \$basearch
baseurl=http://mirrors.cloud.tencent.com/epel/\$releasever/\$basearch/
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/epel/RPM-GPG-KEY-EPEL-7
EOF

yum -y install docker-ce
systemctl restart docker
docker --version

mv /opt/kubeedge/keadm /usr/bin/keadm
cd /opt/k8simage/
bash load.sh

cd /opt/kubeedge
docker load  -i cloudcore.tar
docker load -i installation.tar
docker load -i mosquitto.tar
docker load -i pause.tar

keadm join --cloudcore-ipport=$master_ip:10000 --token=$token

sed -i '/edgeStream:/ {N; s/enable: false/enable: true/}' /etc/kubeedge/config/edgecore.yaml
sed -i '/serviceBus:/ {N; s/enable: false/enable: true/}' /etc/kubeedge/config/edgecore.yaml

systemctl restart edgecore
systemctl status edgecore
【版权声明】本文为华为云社区用户原创内容,未经允许不得转载,如需转载请自行联系原作者进行授权。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。