官方源(仅ubuntu)
kubernetes是谷歌公司弄的东西,google这个名词,国内不方便,你懂得,这里说下谷歌的源是什么
- 添加gpg
$ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
- 添加源
$ vim /etc/apt/sources.list.d/kubernetes.list
添加如下内容
deb http://apt-kubernetes.io/ kubernetes-xenial main
- 执行
$ apt-get update $ apt-get install -y kubelet kubeadm kubectl # 安装指定版本: $ apt-get install kubeadm=1.10.2-00 kubectl=1.10.2-00 kubelet=1.10.2-00 -y
国内源
- ubuntu 16.04 / Debian
$ apt-get update && apt-get install -y apt-transport-https $ curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add - $ cat <<EOF >/etc/apt/sources.list.d/kubernetes.list deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main EOF $ apt-get update $ apt-get install -y kubelet kubeadm kubectl # 安装指定版本: $ apt-get install kubeadm=1.10.2-00 kubectl=1.10.2-00 kubelet=1.10.2-00
- Centos / RHEL / Fedora
$ cat <<EOF > /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/ enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg EOF $ setenforce 0 $ yum install -y kubelet kubeadm kubectl $ systemctl enable kubelet && systemctl start kubelet
本文作者为olei,转载请注明。