先装置 k8s
linux 装置部署 k8s(kubernetes) 和解决遇到的坑和解决遇到的坑 ”)
下载 kubeedge 须要的软件
官网 github 下载 kubeedge 地址
cloudcore.service 文件下载地址
留神: 下载对应的版本和架构
keadm-v1.5.0-linux-amd64.tar.gz
上面的 2 个文件能够不必下载, 装置 kubeedge 时也会主动去下载到 /etc/kubeedge/ 目录, 我这里在线 github 下载很慢, 所以提前下载好
kubeedge-v1.6.1-linux-amd64.tar.gz
cloudcore.service
如果 github 拜访不了, 或者太慢, 能够给我留言或评论, 我发给大家
# 创立文件夹
mkdir /etc/kubeedge/
#把下载的软件复制到 /etc/kubeedge/ 目录, 能够不下载这 2 个文件, 装置时会主动从 github 上在线下载到 /etc/kubeedge/ 目录
#因为拜访 github 很慢, 我提前下载好
cp kubeedge-v1.6.1-linux-amd64.tar.gz /etc/kubeedge/
cp cloudcore.service /etc/kubeedge/
装置 kubeedge 的 cloudcore
–advertise-address=”192.168.0.123″ kubeedge 的 cloudcore 的 IP,edge 边缘节点能拜访的 IP, 如果公网拜访, 倡议应用外网 IP
–kubeedge-version=1.6.1 kubeedge 的版本, 会去下载指定版本的 kubeedge 包
# 解压 keadm
tar -zxvf keadm-v1.6.1-linux-amd64.tar.gz
#初始化装置 kubeedge 的 cloudcore
./keadm-v1.6.1-linux-amd64/keadm/keadm init --advertise-address="192.168.0.123" --kubeedge-version=1.6.1
#输入如下信息胜利:
version=1.6.1
Kubernetes version verification passed, KubeEdge installation will start...
W0511 14:35:30.146678 3524 warnings.go:67] apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
W0511 14:35:30.154102 3524 warnings.go:67] apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
W0511 14:35:30.159650 3524 warnings.go:67] apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
W0511 14:35:30.164732 3524 warnings.go:67] apiextensions.k8s.io/v1beta1 CustomResourceDefinition is deprecated in v1.16+, unavailable in v1.22+; use apiextensions.k8s.io/v1 CustomResourceDefinition
Expected or Default KubeEdge version 1.6.1 is already downloaded and will checksum for it.
kubeedge-v1.6.1-linux-amd64.tar.gz checksum:
checksum_kubeedge-v1.6.1-linux-amd64.tar.gz.txt content:
Expected or Default KubeEdge version 1.6.1 is already downloaded
[Run as service] start to download service file for cloudcore
[Run as service] success to download service file for cloudcore
kubeedge-v1.6.1-linux-amd64/
kubeedge-v1.6.1-linux-amd64/edge/
kubeedge-v1.6.1-linux-amd64/edge/edgecore
kubeedge-v1.6.1-linux-amd64/cloud/
kubeedge-v1.6.1-linux-amd64/cloud/csidriver/
kubeedge-v1.6.1-linux-amd64/cloud/csidriver/csidriver
kubeedge-v1.6.1-linux-amd64/cloud/admission/
kubeedge-v1.6.1-linux-amd64/cloud/admission/admission
kubeedge-v1.6.1-linux-amd64/cloud/cloudcore/
kubeedge-v1.6.1-linux-amd64/cloud/cloudcore/cloudcore
kubeedge-v1.6.1-linux-amd64/version
KubeEdge cloudcore is running, For logs visit: /var/log/kubeedge/cloudcore.log
CloudCore started
#查看 cloudcore 的日志
vim /var/log/kubeedge/cloudcore.log
配置 cloudcore 开机自启动服务
# 查看 cloudcore 启动状况
ps aux|grep cloudcore
#输入如下示意启动:
root 23498 0.1 0.3 1012544 48640 ? Ssl May12 13:11 /usr/local/bin/cloudcore
#查看端口 10000 10002 端口都有了
#没有 netstat 命令, 装置:yum install net-tools -y
netstat -tpnl
#如下:
tcp6 0 0 :::10000 :::* LISTEN 23498/cloudcore
tcp6 0 0 :::10002 :::* LISTEN 23498/cloudcore
#查看 cloudcore 启动状态
systemctl status cloudcore
#如果没有设置开机启动服务则设置 复制开启自启动服务文件
cp /etc/kubeedge/cloudcore.service /etc/systemd/system/cloudcore.service
#增加文件权限
chmod +x /etc/systemd/system/cloudcore.service
#从新加载配置文件
systemctl daemon-reload
#查看 cloudcore 启动的过程 id, 而后杀掉
ps aux|grep cloudcore
#输入如下:
root 23498 0.1 0.3 1012544 48640 ? Ssl May12 13:12 /usr/local/bin/cloudcore
#杀掉
kill -9 23498
#启动 cloudcore
systemctl start cloudcore
#设置开机自启动
systemctl enable cloudcore.service
#查看 cloudcore 开机启动状态 enabled: 开启, disabled: 敞开
systemctl is-enabled cloudcore.service
获取 kubeedge 的 token
./keadm-v1.6.1-linux-amd64/keadm/keadm gettoken