Kubernetes

1、安装Kubernetes基础组件

配置镜像仓库

官方镜像源国内不可用

  1. cat <<EOF > /etc/yum.repos.d/kubernetes.repo
  2. [kubernetes]
  3. name=Kubernetes
  4. baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
  5. enabled=1
  6. gpgcheck=1
  7. repo_gpgcheck=1
  8. gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
  9. EOF
  10. $ yum install -y kubelet kubeadm kubectl
  11. systemctl enable kubelet && systemctl start kubelet

配置使用阿里云镜像仓库并下载安装推荐

阿里云Kubernetes镜像地址:https://developer.aliyun.com/mirror/kubernetes?spm=a2c6h.13651102.0.0.5b791b11ILfyDS

Debian / Ubuntu
  1. apt-get update && apt-get install -y apt-transport-https
  2. curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add -
  3. cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
  4. deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
  5. EOF
  6. apt-get update
  7. apt-get install -y kubelet kubeadm kubectl
  8. systemctl enable kubelet && systemctl start kubelet
CentOS / RHEL / Fedora
  1. cat <<EOF > /etc/yum.repos.d/kubernetes.repo
  2. [kubernetes]
  3. name=Kubernetes
  4. baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
  5. enabled=1
  6. gpgcheck=1
  7. repo_gpgcheck=1
  8. gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
  9. EOF
  10. setenforce 0
  11. yum install -y kubelet kubeadm kubectl
  12. systemctl enable kubelet && systemctl start kubelet

安装升级Kubernetes基础组件kubelet kubeadm kubectl - 图1