kubeedge 安装部署(适用于Ubuntu)
-
基础环境:安装了Ubuntu 18.04操作系统的两台虚拟机 (查看操作系统版本命令:
cat /etc/os-release
) -
部署
kubeedge1.1.0
版本 -
根据
keadm
源码安装部署步骤整理(无法直接使用keadm
工具完成部署)
一、配置源,写入以下内容到 /etc/apt/sources.list
root@ubuntu:~# cat /etc/apt/sources.list
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
root@ubuntu:~# apt-get update
二、安装 docker
root@ubuntu:~# apt-get update
root@ubuntu:~#
root@ubuntu:~# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add
OK
root@intellif-edge:~# cat /etc/apt/sources.list.d/docker.list
deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable
root@ubuntu:~#
root@intellif-edge:~# apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
root@ubuntu:~# apt-cache madison 'docker-ce' | grep 19.03.4 | head -1 | awk '{$1=$1};1' | cut -d' ' -f 3
5:19.03.4~3-0~ubuntu-bionic
root@ubuntu:~#
root@ubuntu:~# apt-get install -y --allow-change-held-packages --allow-downgrades docker-ce=5:19.03.4~3-0~ubuntu-bionic
root@ubuntu:~#
root@ubuntu:~# systemctl enable docker
三、安装 kubeadm kubelet kubectl
root@ubuntu:~# cat /etc/apt/sources.list.d/kubernetes.list
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
root@ubuntu:~#
root@ubuntu:~# curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add -
root@ubuntu:~# apt-get update
root@ubuntu:~# apt-cache madison 'kubeadm' | grep 1.16.2 | head -1 | awk '{$1=$1};1' | cut -d' ' -f 3
1.16.2-00
root@ubuntu:~# apt-get install -y --allow-change-held-packages --allow-downgrades kubeadm=1.16.2-00 kubelet=1.16.2-00 kubectl=1.16.2-00
四、kubeedge
证书生成
- 准备生成证书脚本,将如下生成证书的脚本写入到
/etc/kubeedge/certgen.sh
#!/bin/sh
readonly caPath=${CA_PATH:-/etc/kubeedge/ca}
readonly caSubject=${CA_SUBJECT:-/C=CN/ST=Zhejiang/L=Hangzhou/O=KubeEdge/CN=kubeedge.io}
readonly certPath=${CERT_PATH:-/etc/kubeedge/certs}
readonly subject=${SUBJECT:-/C=CN/ST=Zhejiang/L=Hangzhou/O=KubeEdge/CN=kubeedge.io}
genCA() {
openssl genrsa -des3 -out ${caPath}/rootCA.key -passout pass:kubeedge.io 4096
openssl req -x509 -new -nodes -key ${caPath}/rootCA.key -sha256 -days 3650 \
-subj ${subject} -passin pass:kubeedge.io -out ${caPath}/rootCA.crt
}
ensureCA